DEV Community

Git Log Guides

Git log will print a the last n commits in a repo. Learn more in the guides below

This is a collection of top and trending guides written by the community on subjects related to Git Log properties. For all things git, check out the git tag! Please contribute more posts like this to help your fellow developer in need.

Enhance your git log with conventional commits

I think we shouldn't confound git commit with ctrl + s. A git log should be like reading a story. By reading the log, I should be able to understand in ~10s the whole file history.

10 helpful flags to use with git log command.

We know that when it comes to logging or let’s say log files, it’s all about investigating or searching in the history for sure of your system or program that you’re working on, to know what’s going on with your stuff and check the current state of your system or program.

git log --simplify-by-decoration is my new best friend

In short, it's this: git log --decorate --graph --simplify-by-decoration --oneline [--all]

Git log pretty print aliases

A couple of git aliases for git log pretty print. Add them to your .zshrc or .bashrc for usage and source the file e.g.source ~/.zshrc, or restart your terminal for the changes to apply.

Git log a range of lines of a file

git log -L 50,75:./some/path/file.ext

Making git log prettier

Git without saying is a fantastic tool; but git log by default is a little ugly and actually sometimes can be a little difficult to read branches and merges quickly and accurately.

Better Git Log Styling

git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

Visualize Git Log Tree

The git log is a powerful command which shows commit history.

Happy Git Log coding!