jimeh / git-aware-prompt

Display current Git branch name in your terminal prompt when in a Git working directory.
Creative Commons Zero v1.0 Universal
2.16k stars 340 forks source link

Use __git_ps1 instead of custom solution to determine the current branch #12

Closed phacops closed 7 years ago

phacops commented 10 years ago

The current custom solution doesn't show when a branch is in merging state for example. Using the git tool for the prompt might be a better idea.

jimeh commented 10 years ago

Apologies for my delayed response.

Is the __git_ps1 command included in all git distributions? I've currently got v1.9 installed via Homebrew on OSX, and no __git_ps1 command available.

phacops commented 10 years ago

Sorry for the late answer.

I believe it is included in all git distribution as it's part of the git contrib folder. I think you just have to source it before.

You can find the script here: https://raw.githubusercontent.com/git/git/master/contrib/completion/git-prompt.sh.

jimeh commented 10 years ago

Interesting, I'll have a look into it this weekend hopefully. I'll probably keep the home grown solution included and used as a fallback if __git_ps1 isn't available, unless you have any objections :)