Git comes with a very power history viewing command – git log
, which supports a number of command line parameters.
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.