If you're working in a team with other developers, you probably use
git log quite a lot to work out what's going on when you pull down new code. Whilst it works, it's not the greatest view of the data. You can customise this view using the
--pretty flag, passing one of the following values to it (e.g. git log --pretty=oneline).
As well as those values, you can specify your own format using the
--pretty=format:'' flag. For a list of available fields, see this useful post by Alex Fish.
Here's a few of the ones I like personally. If you want to use any of them, I'd advise adding them as an alias using:
git config --global alias.alias_name "log [options]"
e.g. To run
git lg to see a nice one line summary
git config --global alias.lg "log --graph --decorate --oneline --all"
Useful git-log options
A quick one line summary of each commit:
git log --pretty=oneline
41281c5 Better cssh demo video6f8564f Add post on cssh5d090c9 Missing /1938d38 Fix sed article errors1c6f9f7 Add post about working with large files and sed
This is the one I personally use. I use the
--all flag to show commits to remote branches as well as local branches.
git log --graph --decorate --oneline --all
* 5ddf436 Merge in adam's compiled changes + my code padding change* b597f3f Merge pull request #2 from sirbrad/styling-fixes|\| * 739eed3 Fixes a few things;* | 7adcaf7 Merge pull request #1 from AdamWhitcroft/gh-pages|\ \| |/|/|
A colourful, super-informative view including branching history (via jukie.net)
log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative
Outputs (with more colours!):
* 5ddf436 - Merge in adam's compiled changes + my code padding change (7 weeks ago)* b597f3f - Merge pull request #2 from sirbrad/styling-fixes (8 weeks ago)|\| * 739eed3 - Fixes a few things; (8 weeks ago)* | 7adcaf7 - Merge pull request #1 from AdamWhitcroft/gh-pages (8 weeks ago)|\ \| |/|/|