10 second Git tip: What’s changed since master?

All the work we do at mySociety is constructed in work-in-progress branches, until it has been reviewed and merged into master. As a front-end guy at mySociety, I tend to jump a lot between projects, and often need to remind myself what changes I’ve made in a given branch, and how far I’ve got towards the end goal.

I find the default git log output pretty unwieldy for this purpose. Instead, I ask Git to show me only the commits made since the current branch diverged from the master branch. Like this:

$ git lg master..

Where git lg is an alias in my ~/.gitconfig file, like this:

  lg = log --abbrev-commit --date=short --pretty=tformat:'%C(yellow)%h %C(cyan)%ai%C(red)%d%Creset %s %C(green)<%an>%Creset'

It works even if your local copy of master contains commits that were made after your branch was started – you’ll just see all the commits made since your branch diverged from master.