Home Explore Blog CI



git

3rd chunk of `Documentation/git-log.adoc`
b5c6a2d8326f76fa19d69ba52be2de57e1bb9a99ad5a8f390000000100000c90
  See 'History
	Simplification' below for details and other simplification
	modes.
+
Paths may need to be prefixed with `--` to separate them from
options or the revision range, when confusion arises.

include::rev-list-options.adoc[]

include::pretty-formats.adoc[]

DIFF FORMATTING
---------------

By default, `git log` does not generate any diff output. The options
below can be used to show the changes made by each commit.

Note that unless one of `--diff-merges` variants (including short
`-m`, `-c`, `--cc`, and `--dd` options) is explicitly given, merge commits
will not show a diff, even if a diff format like `--patch` is
selected, nor will they match search options like `-S`. The exception
is when `--first-parent` is in use, in which case `first-parent` is
the default format for merge commits.

:git-log: 1
:diff-merges-default: `off`
include::diff-options.adoc[]

include::diff-generate-patch.adoc[]

EXAMPLES
--------
`git log --no-merges`::

	Show the whole commit history, but skip any merges

`git log v2.6.12.. include/scsi drivers/scsi`::

	Show all commits since version 'v2.6.12' that changed any file
	in the `include/scsi` or `drivers/scsi` subdirectories

`git log --since="2 weeks ago" -- gitk`::

	Show the changes during the last two weeks to the file 'gitk'.
	The `--` is necessary to avoid confusion with the *branch* named
	'gitk'

`git log --name-status release..test`::

	Show the commits that are in the "test" branch but not yet
	in the "release" branch, along with the list of paths
	each commit modifies.

`git log --follow builtin/rev-list.c`::

	Shows the commits that changed `builtin/rev-list.c`, including
	those commits that occurred before the file was given its
	present name.

`git log --branches --not --remotes=origin`::

	Shows all commits that are in any of local branches but not in
	any of remote-tracking branches for 'origin' (what you have that
	origin doesn't).

`git log master --not --remotes=*/master`::

	Shows all commits that are in local master but not in any remote
	repository master branches.

`git log -p -m --first-parent`::

	Shows the history including change diffs, but only from the
	``main branch'' perspective, skipping commits that come from merged
	branches, and showing full diffs of changes introduced by the merges.
	This makes sense only when following a strict policy of merging all
	topic branches when staying on a single integration branch.

`git log -L '/int main/',/^}/:main.c`::

	Shows how the function `main()` in the file `main.c` evolved
	over time.

`git log -3`::

	Limits the number of commits to show to 3.

DISCUSSION
----------

include::i18n.adoc[]

CONFIGURATION
-------------

See linkgit:git-config[1] for core variables and linkgit:git-diff[1]
for settings related to diff generation.

format.pretty::
	Default for the `--format` option.  (See 'Pretty Formats' above.)
	Defaults to `medium`.

i18n.logOutputEncoding::
	Encoding to use when displaying logs.  (See 'Discussion' above.)
	Defaults to the value of `i18n.commitEncoding` if set, and UTF-8
	otherwise.

include::includes/cmd-config-section-rest.adoc[]

include::config/log.adoc[]

include::config/notes.adoc[]

GIT
---
Part of the linkgit:git[1] suite

Title: Git Log Command Options and Examples
Summary
The git log command provides various options to control the output and formatting of commit logs, including diff formatting, history simplification, and commit filtering, with examples demonstrating how to use these options to show commit history, filter commits, and display changes made by each commit.