Project

General

Profile

A Git-aware Shell

It is helpful to have your shell aware of git for various purposes

  • make your prompt react to entering a git controlled directory and have it display info about its state
  • provide command TAB-completion

Git distributions provide support for this, although your OS or the UPS packaged version may lack them. You can download the completion commands appropriate to your shell here:

https://github.com/git/git/tree/master/contrib/completion

Click on the "Raw" button for a downloadable link.

If you "source" it you will gain the ability to use TAB completion. You may also use the functions defined there to markup your prompt. For example, in Bash you may do:

boringprompt> source git-completion.bash
boringprompt> export PS1='$(__git_ps1 "(%s)")\u@\h:\W> '
bvlbne@lbne0001:~> cd myrepo
(master)bvlbne@lbne0001:myrepo> 

See also the git-prompt.sh for more fanciness.