alexkras.com

  • Home
  • Top Posts
  • Resume
  • Projects
  • YouTube
  • Boots to Bytes
  • About
  • Contact

How to use git log command line parameters

February 3, 2017 by Alex Kras Leave a Comment

Git comes with a very power history viewing command – git log, which supports a number of command line parameters.

git-log-oneline

This options are very powerful, especially when used in combination. Here are the ones that I use the most:

  • --author=“Alex Kras" – Only show commits made by a certain author
  • --name-only – Only show names of files that changed
  • --oneline – Show commit data compressed to one line
  • --graph – Show dependency tree for all commits
  • --reverse – Show commits in reverse order (Oldest commit first)
  • --after – Show all commits that happened after certain date
  • --before – Show all commits that happened before certain data

For example, I once had a manager who required weekly reports submitted each Friday. So every Friday I would just run: git log --author="Alex Kras" --after="1 week ago" --oneline, edit it a little and send it in to the manager for review.

Git has a lot more command line parameters that are handy. Just run man git-log from your terminal and see what it can do for you.

If everything else fails, git has a --pretty parameter that let’s you create a highly customizable output. i.e git log --pretty="%t - %an - %s" --graph which will output abbreviated commit, author name, and first line of the commit message.

Filed Under: Git Tagged With: git

I work for Evernote and we are hiring!

Subscribe to this Blog via Email

New posts only. No other messages will be sent.

You can find me on LinkedIn, GitHub, Twitter or Facebook.

This blog is moving to techtldr.com

Leave a Reply Cancel reply

Copyright © 2021 · eleven40 Pro Theme on Genesis Framework · WordPress · Log in