Git Log tricks

The idea here would be to show some git log tricks and to develop the article, whenever I find something more and more worthy. Before starting this one, please remember that exiting vim editors in the command prompt is with :q.

  • Git Log with only 5 last commits
git log -n 5
  • Git Log with all commits since 2022
git log --after="2022-1-1"
  • Have everything important on 1 line, like a story
git log --oneline
  • Git Log with all commits affecting a specific file from the repository
git log -- README.md
  • History of all commits of a git file
git log -p Formatting >here.txt
  • Grouping by author
git shortlog
  • Searching through commits, for a specific word
git log -S comments

returning this:

That’s all folks! 🙂