Information Technology Reference
In-Depth Information
The parameter
--pretty=format
allows you to define the arbitrary output's
format. The special string containing placeholders defines the output. The command:
$ git log --pretty=format:"%an --- %H"
will print the output in this form:
Joe Doe --- 123456...
The first part of the output (e.g., Joe Doe) is the author's name, while the second
part is a full SHA-1 of a revision. This output is produced with two placeholders:
%an - author's name
%H - full SHA-1 hash
The other useful placeholders include:
%h: abbreviated commit hash,
%ae: author email,
%ad: author date,
%cn: committer name,
%ce: committer email,
%cd: committer date,
%e: encoding,
%s: subject,
%n: newline.
Hint
A full list of placeholders is available in the manual for
git log
. You can ac-
cess it with the
git help log
command.
Here are some parameters to filter revisions included in the output:
-n
—number of revisions, for example, -7 restricts git log to the last
seven revisions
--since="yyyy-mm-dd"
—starting date
--until="yyyy-mm-dd"
—finishing date