Skip to content

Instantly share code, notes, and snippets.

@scriptonian
Created September 30, 2016 17:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scriptonian/14af2cd0491f7881025f44f2a08c3d3f to your computer and use it in GitHub Desktop.
Save scriptonian/14af2cd0491f7881025f44f2a08c3d3f to your computer and use it in GitHub Desktop.
1.
git log
this allows you to see a history of commits
2.
git log --pretty=oneline
limit output to one line per commit. as oppose to the first one that shows quite a bit of info. like author and date, etc
3.
git log --pretty='%h | %d %s ($cr) [%an]'
h: abreviated hash, d:any reference pointing to commit, $s:first line of commit message, %cr: timestamp when commit was made, %an: commit author
see options at http://git-scm.com/docs/pretty-formats
4.
git log --pretty='%Cred%h%Creset | %C(yellow)%d Creset %s %Cgreen($cr)%Creset %C(cyan)[%an]%Creset'
same as before but we are adding color to it.
5.
git log --pretty='%Cred%h%Creset | %C(yellow)%d Creset %s %Cgreen($cr)%Creset %C(cyan)[%an]%Creset' --graph --all
add a graph representation to log
6.
git config --global alias.lg "log --pretty='%Cred%h%Creset | %C(yellow)%d Creset %s %Cgreen($cr)%Creset %C(cyan)[%an]%Creset' --graph --all"
creates an alias for #5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment