Set up git 1.8 with git completion and customized prompt

And colorize the text in terminal at the same time

 

Mac instructions:

Run

defaults write com.apple.Finder AppleShowAllFiles YES

in Terminal first so that hidden files can be seen in Finder.  Changing Yes to No will turn them off again.

Get git-completion.bash and git-prompt.sh from git and install them in your user directory

.git-completion.bash

http://johnfgibb.com/how-to-install-git-autocompletion 

or, easier,

curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o /.git-completion.bash

 .git-prompt

https://raw.github.com/git/git/master/contrib/completion/git-prompt.sh

copy the code and save it into ~/.git-prompt.sh

 

Edit .bash_profile

Create it in ~/ if it’s not there already

if [ -f ~/.git-completion.bash ]; then
 source ~/.git-completion.bash
fi
if [ -f ~/.git-prompt.sh ]; then
 source ~/.git-prompt.sh
fi
export PS1='\u: \W$(__git_ps1 "(%s)") > '

 

 

 

Set up with color coded text

.gitconfig

[user]
name = xxxxxxx
email = xx@example.com
[github]
user = xxxxxxx
[color]
branch = auto
diff = auto
status = auto

[color “branch”]
current = yellow reverse
local = yellow
remote = green

[color “diff”]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold

[color “status”]
added = yellow
changed = green
untracked = cyan