A more helpful git log

The git log command is useful in viewing history of changed repository content, but the default output leaves a lot to be desired:


An easy enhancement to the default is to add the “–oneline” parameter which makes it easier to see commit history in a linear fashion:


The colors here are part of my .gitconfig settings and are helpful for parsing commit SHA’s from commit log messages. But, we can do better than this…

Try adding this git “hist” alias to your own .gitconfig file to produce an even more helpful git log output:

 fa = fetch --all
 far = fetch --all --recurse-submodules 
 hist = log --pretty=format:'%Cred%h%Creset - %s %Cgreen(%cr) %C(bold blue)<%an>%Creset %C(yellow)%d%Creset' --abbrev-commit

Now, running “git hist” will produce this more easily parseable version of git log output, one that can be quite useful in finding exact commits by relative date:


Much better, don’t you think?


One thought on “A more helpful git log

  1. djsynthe says:

    I use this one, give it a try:

    git log –graph –pretty=format:’%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)%Creset’ –abbrev-commit –date=relative”

    Liked by 1 person

Comments are closed.