Like ephemient said, you will want to have that Git bash script installed, installation instructions are near the top of the file. You might also want to check out the Github guide page for this. One thing worth noting is that the branch will only show up if you are in a git directory. For example, this is what my normal prompt looks like: blaenk@macbook:~ $
and the prompt looks like this when I am in a git directory: blaenk@macbook:~/code/iphone/DIFM (master*)$
If you look closely, the part where it shows the branch, master, has an asterisk after it. This signifies that there are unstaged changes; it will show a + if changes are staged. This can be pretty helpful. To do this, you basically have to set GIT_PS1_SHOWSTASHSTATE
to a non-empty state. So for example in your ~/.bashrc
or ~/.bash_profile
, put the following:
export GIT_PS1_SHOWDIRTYSTATE=true
Now when you go to a git directory, you should see the indicator if there are any unstaged changes or if there are any staged changes. You can test this out really quick by editing a file. The asterisk should show up. You can then restore the file to its original state by doing:
git checkout -- the/file.txt
By the way, that auto complete bash script is also really awesome. You can finally do stuff like 'git chec' then press TAB, and it'll autocomplete to checkout for example, and you can also auto complete branch names too.
Some other resources you will most likely be interested in are the following, which guide you through the process of shaping your prompt the way you want it, and if you want, adding color to certain parts, which can make for a much more readable and informative prompt. Just try not to overdo it.