Product SiteDocumentation Site

3.3.9. Commit logs

After working with a repository for some time, making several changes and commits, a need may arise to view the logs of these changes. This is done with the git log command. When this is run with no arguments, it lists each commit in reverse chronological order, presenting the time and date of the commit, the SHA-1 checksum, the author's name and email, and the commit message.
It is possible to include the diff report in these logs, and limit the output by a set number of entries. For example, running git log -p -2 will list the normal log information in addition to the diff reports for the two most recent entries.
To include some statistics at the end of each commit entry, use the git log --stat. This command will include a list of modified files, how many files were changed, and how many lines were added and removed, followed by a summary of this information, after the commit message.
Along with these useful options, there are a number of others which can be passed with this command:
--shortstat
Similar to the --stat option, but this displays only the changed, insertions, and deletions in a commit.
--name-only
Lists only the files modified after the commit information.
--name-status
Lists the files modified along with the changed, insertions, and deletions.
--abbrev-commit
Only displays the first few characters of the SHA-1 checksum, instead of all forty.
--relative-date
Displays the date relative to the current date. For example, instead of reading Tue July 10:53:11 2011 -0700, it will print 2 weeks ago.
--graph Display
Prints an ASCII graph of the branch and merge history beside the log output.
--since=[date]
Prints the log since a specified date; that is, everything after the date. The date can be entered in a variety of different formats, be it a specific date (2010-08-23, for example) or a relative date ("1 year 3 days 4 minutes ago", for example).
--until=[date]
Similar to the --since option, this will print the log up until the specified date; that is, everything before the date.
--author name
Lists only those commits with the specified name in the author field.
--committer name
Lists only those commits with the specified name in the committer field.