Git Autocompletion and Status Prompt in Terminal
To get autocompletion of Git subcommands, branch and tag names, etc. in your Terminal, just download
git-completion.bash, that comes with Git, to somewhere (e.g.
~/.git-completion.bash) and update your
.bash_profile as follows:
# git autocompletion source ~/.git-completion.bash
And to see repository status in your prompt, just download
git-prompt.sh, that comes with Git, to somewhere (e.g.
~/.git-prompt.sh) and update your
.bash_profile to something like this:
# git prompt source ~/.git-prompt.sh GIT_PS1_SHOWDIRTYSTATE=1 GIT_PS1_SHOWSTASHSTATE=1 GIT_PS1_SHOWUNTRACKEDFILES=1 GIT_PS1_SHOWCOLORHINTS=1 GIT_PS1_DESCRIBE_STYLE="branch" GIT_PS1_SHOWUPSTREAM="auto git" PROMPT_COMMAND='__git_ps1 "[\t] \u@\h:\w" "\\\$ " '
More details and other options are explained in both files.