A little bit of git
Using git after SVN is like driving a Ferrari after driving a Jaguar. Nimble, speedy, lovely. My word it’s beautiful.
Anyway, I’m learning my way around it and, recently, came across these two lovely things:
Colouring the git output (from @catchamonkey)
I didn’t realise how useful colouring the output of things like git diff and git status etc was until I’d done it. Follow the below:
%> vi ~/.gitconfig
This will open the global .gitconfig file for your CURRENT user in vi. It will probably look something like this:
[user] name = Mike Pearce email = mike.pearce@jellyfish.co.uk
Below all that, you’ll need to add this:
[color]
ui = 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
Obviously, you can change the colours to suit your particular pallete, but the above are pretty cool!
Global Ignorance (via @nefarioustim)
Sometimes, you’ll want to ignore the same file for each git repo. You can add the ignored files to the git repo itself, or, if you know there’ll always be a file or files you want to ignore, you can add it to git excludes.
I use netbeans on a mac, so I generally ignore the following:
- .DS_Store
- ./nbproject
- *.pc (compiled python code)
You can do it by editing the .gitconfig file again:
%> vi ~/.gitconfig
Then adding the following lines somewhere:
[core] excludesfile = ~/.gitexcludes
OK, save then, then do this:
%> vi ~/.gitexcludes
and add each one on a new line:
DS_Store nbproject *.pc
Save that et voila. You’ll never be troubled with those files being added to your repo again.

leave a comment