Name
log
Synopsis
git [revision
...] [--path
...]
Show the commit history. If paths are specified, show only the history related to the given files or directories. If revisions are specified, show the history starting from the given revisions. The default revision is HEAD. With --all, the default is to show all revisions in all local branches.
Each revision can be specified in one of the following formats:
- commit
Include the history for the given commit.
- ^commit
Exclude the history starting at the given commit.
- a..b
Includes all commits in b that are not in a. Equivalent to b ^a.
- a...b
Includes all commits in a and b that are not in both.
Options
--all |
-p (show patch) |
-Un, --unified=n |
-a, --text |
--raw |
--stat |
-M (detect renames) |
-C (detect copies) |
--find-copies-harder |
-R (reverse patch) |
-w, --ignore-all-space |
-n, --max-count=n (show up to only n commits) |
--pretty=(oneline|short|medium|full|fuller|email|raw|format:...) |
--abbrev-commit |
--full-history |
--no-merges |
--first-parent |
--parents |
--left-right |
--graph |
--author=regex |
--committer=regex |
--grep=regex |
--reverse |
Examples
To show the commits on this branch, starting with the most recent:
$ git log
commit 3ad3a1c1866bef36461d549d87fe39babe412d61
Author: John Smith <jsmith@example.com>
Date: Sun Jan 18 18:41:32 2009 −0500
Make some changes.
commit 529fc80df85a5ec7c88552bcb27bc0770a84e336
Author: John Smith <jsmith@example.com>
Date: Sun Jan 17 12:13:06 2009 −0500
Do the first thing.
...
To show what was changed by the most recent commit:
$ git log −1 -p
diff --git a/server/hello.html ...
Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.