When working with a git repository you need to know which branch you are committing to. To do that you type git status and check for the info. Sometimes you just need to know the branch in order not to make mistakes when merging. It is super useful to have branch name as part of the command prompt.
Instructions for installation are pretty simple and work quite well out of the box.
There are a lot of forks of this repository. Specially interesting is this one by Paul “Joey” Clark: https://github.com/joeytwiddle/git-aware-prompt
- shows you how far your local branch is ahead or behind the repository’s branch
- shows how many files are staged
- indicates when you have an un-popped stash (when the top stash entry was made on the current commit or the current branch)
- displays when you are on a detached commit, or paused during a merge, rebase or cherry-pick
- adds a timeout for slower machines so that you will get your prompt quickly, even if
git statusis taking too long to retrieve the dirty and staged stats.
In the end, you are left with branch name in your prompt:
Or, like this if you used joeytwiddle’s repository: