After the project I thought about starting to use subversion at work to track various projects, but branching was the most useful feature, and it seemed too hard to do regularly. Git was still quite new then, but recently I looked at it again, and it's much easier to use now than subversion (IMHO).
Git has many advantages for me as my primary development machine is a laptop. I prefer to create a branch for feature work, and this is trivial to do in Git. There are plenty of resources and tutorials out there, but here are a couple of things I found particularly useful.
The first are bash aliases:
alias gst='git status '
alias gc='git commit '
alias gca='git commit -a '
alias ga='git add '
alias gco='git checkout '
alias gb='git branch '
alias gm='git merge '
The second is displaying the current branch in the prompt. If you are making and moving between a lot of branches - and once you start using Git you will - this helps you keep track of where you are.
This tip uses the __git_ps1 function supplied as part of a contributed package.
Copy the git-completion.bash file from the contrib folder in the Git source tree to somewhere like .~/.git-completion.sh, and add this line to your .bashrc file:
Then change your prompt to something like this:
export PS1='\h:\w\[\033[32m\]$(__git_ps1) \[\033[0m\]$ '
NB: This function will also show the SHA1 of the current checkout if that is not an actual branch.
The included file also allows the following to be auto-completed:
- local and remote branch names
- local and remote tag names
- .git/remotes file names
- git 'subcommands'
- tree paths within 'ref:path/to/file' expressions
- common --long-options
complete -o default -o nospace -F _git_branch gb
complete -o default -o nospace -F _git_checkout gco