ollieshmollie ollieshmollie - 1 year ago 98
Git Question

Why does git-prompt.sh indicate my branches have diverged?

I recently switched from git-aware-prompt to git's git-prompt.sh because I like the added features. However, after setting

in my bash profile, every repo I'm using with GitHub indicates a divergence with '<>', instead of the expected '='.

I don't understand this because
git status
Your branch is up-to-date with 'origin/master'. nothing to commit, working tree clean

git pull
Already up-to-date
. Am I missing something about divergence, or is git-prompt.sh not behaving properly? Thanks in advance.

Answer Source

So I finally got access to my friend's machine, and tried curling the raw script into the correct directory: curl https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh -o /usr/local/etc/bash_completion.d/git-prompt.sh. It worked! But no one should do this until they're positive that a. git is installed via Homebrew (you can verify this; if which git returns /usr/local/bin/git and you didn't make that symlink yourself, you're all set. b. No git links are broken (brew unlink git then brew link git ought to fix any problems)

Based on @torek's expertise, I've come to the conclusion that Sublime 3 might have been converting tabs to spaces and breaking the script. The solution is not to open git-prompt.sh in any text editor, but instead curl it directly into the above directory. This way one can be sure that it is uncorrupted and works as advertised.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download