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:


Include the history for the given commit.


Exclude the history starting at the given commit.


Includes all commits in b that are not in a. Equivalent to b ^a.


Includes all commits in a and b that are not in both.


-p (show patch)
-Un, --unified=n
-a, --text
-M (detect renames)
-C (detect copies)
-R (reverse patch)
-w, --ignore-all-space
-n, --max-count=n (show up to only n commits)


To show the commits on this branch, starting with the most recent:

$ git log
commit 3ad3a1c1866bef36461d549d87fe39babe412d61
Author: John Smith <>
Date:   Sun Jan 18 18:41:32 2009 −0500

    Make some changes.

commit 529fc80df85a5ec7c88552bcb27bc0770a84e336
Author: John Smith <>
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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.