Friday, November 14, 2014

git lsd – For when you don't want to use gitk --all

If all you want is a quick look at your commit history with all the branches nicely laid out with their merges shown with pretty colored lines... Try this instead of one of the gui viewers:
git log --graph --boundary '--format=%C(yellow)%h%Creset%C(bold cyan)%d%Creset %s %C(dim normal)(%ar)%Creset' --all
This will output something like this (depending on your terminal color settings):
* 4b22a90 (HEAD, master) erases chip before programming (2 days ago)
*   ee107af Merge branch 'sysclk' (2 days ago)
|\  
| * e9df6f6 removes clk config to use defaults (2 days ago)
| * 66a1ea3 fixes clkout pin timing (2 days ago)
| * bcdda54 enables PLL @ 16MHz (internal 2MHz x 8) (2 days ago)
| * cd22bab enables the 32KHz rc for system clock (2 days ago)
| * cee8efd enables the internal 32MHz rc for sysclk (2 days ago)
| * aa10b4d enables 2MHz internal rc osc for sysclk (2 days ago)
| * 80cbade re-defines F_CPU (2 days ago)
|/  
*   0644c9d Merge branch 'diagnostics' (3 days ago)
|\  
| * b9e155d adds SYSCLK/10000 on pin A0 (3 days ago)
| * 57807ab adds blinky led (3 days ago)
|/  
* 5cfc996 basic skeleton (3 days ago)
Of course you can mess with the format and colors, but this is how I like it. Once you have it set the way you like it, alias it for later use!
git config --global alias.lsd "log --graph --boundary '--format=%C(yellow)%h%Creset%C(bold cyan)%d%Creset %s %C(dim normal)(%ar)%Creset' --all"
Now you can just type git lsd and have a quick overview of your commits.

No comments :