twolfson / sexy-bash-prompt

Bash prompt with colors, git statuses, and git branches.
MIT License
1.14k stars 155 forks source link

Branch with multiple remotes always appears unpushed? #68

Closed abhijit86k closed 7 years ago

abhijit86k commented 7 years ago

On one of my repos I have set up two remotes (redundancy). Even after pushing to both remotes, the prompt indicates 'unpushed' status. I haven't had time to look into this yet with a clean test case, so it may just be some quirk on my repo.

twolfson commented 7 years ago

We have hardcoded to origin as the remote to compare to as that's the git convention.

https://github.com/twolfson/sexy-bash-prompt/blob/0.26.7/.bash_prompt#L166-L167

What are your remotes named?

If neither of them is named origin but you have branch tracking set up, there's probably a way to resolve remote based on the branch itself.

abhijit86k commented 7 years ago

My remotes were called "server1_name" "server2_name" and "usb". I tried renaming the server1 remote to origin using git remote rename, but that didn't seem to change anything. I'll try to look into it over the weekend.

twolfson commented 7 years ago

Ah, weird. As a heads up GitHub is hiding the <server1>/<server2> due to thinking they were HTML tags =/

abhijit86k commented 7 years ago

Updated the comment. I was wondering what happened :)

abhijit86k commented 7 years ago

"git remote rename" does work. In any case, there can be cases where there are multiple remotes and the default tracking branches differ. I've added the check and created a pull request. You can merge it and close this thread.

twolfson commented 7 years ago

Forgot to close this. This has been resolved via #69 and #70 and released in 0.27.0