How to format Git log for meaningful information


Bookmark and Share

Git is a wonderful piece of software that makes life easier and more productive for a programmer. But sadly most developers don’t use it up to their full potential so we are going to blog about various simple and advanced usages of git as a series. In the first article of the series, we are going to talk about git logs.

Git log is a great feature, that allows us to keep track of our works. There are different options available under git log command, which help us to customize the output of git log and also to filter the log.

Git Graphs

The –graph option draws a graph representing the branches and its structure of commit history. –oneline is used to display commit message and its hash in a single line, which is used along with –decorate, which helps us to easily see which commit belongs to which branch.

Custom formatting

This lets you display each commit however you want in printf style. For example %cn,  %h and %cd which represents committer name, abbreviated hash and committer date respectively.

Filtering the output

Git log can be filtered …

Read More