lixo.org

Git Tip: Set Your Identification and Colours

Absolute must-do for any new git users out there: set your name and email, so people can know who did what in the code!


git config --global user.name "John Doe"
git config --global user.email "john.doe@company.com"


Also, if you’re a command-line user (and who isn’t?!), make sure you configure it to add a splash of colour to its output. It’s really useful.


git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto


Oh, and in case you’re pair programming, this little script goes a long way:


#!/usr/bin/env ruby

def usage
puts "./pair [name] [name]: pair two people"
exit
end

usage if ARGV.size != 2

pair = [ARGV[0], ARGV[1]]

puts "pairing #{pair.first} and #{pair.last}"
`git config user.name "#{pair.first} & #{pair.last}"`
`git config user.email #{pair.first}+#{pair.last}@company.com`


And that’s it :)