Few Useful Command for Git Log Commit
2021/01/112 min read
bookmark this
Table of Contents
- Introduction
- Filter by Author
- Filter by Date
- Filter by Author and Date
- Pretty Print Commit Log
- Navigation Commands
- Conclusion
Introduction
Here are a few useful commands if you want to get a list of git commit information. These commands help you filter, format, and navigate through your git log history.
Filter by Author
This will list all the commits by the contributor.
git log --author="Contributor's name"
Filter by Date
Get commits from 19 April 2020.
git shortlog -s -n --since="19 April 2020"
Filter by Author and Date
Get commits for the contributor since 19 April 2020.
git log --author="Your contributor" --oneline --since="19 April 2020"
Pretty Print Commit Log
Same commit log but make it pretty print.
git log --pretty="%C(Yellow)%h %C(reset)%ad (%C(Green)%cr%C(reset))%x09 %C(Cyan)%an: %C(reset)%s" --author="contributor" --since="19 May 2020 12:00:00 AM"
Navigation Commands
Quit the command line by :q.
:q
Use :h for the help command.
:h
Conclusion
These are a few handy git log commands that can help you quickly filter commits by author, date, or both, and format the output for easier reading. Combine these options to find exactly the commit information you need.