Git log#
$ git log [-n COUNT]
list the commit history of the current branch.
-n
limits the number of commits to the specified number.
$ git log [--after="YYYY-MM-DD"] [--before="YYYY-MM-DD"]
Commit history filtered by date.
Relative information such as
1 week ago
oryesterday
is also permitted.$ git log --author="NAME"
filters the commit history by authors.
You can also search for several authors at the same time, for example
$ git log --author="VEIT|VSC"
$ git log --grep = "TERM"
filters the commit history for regular expressions in the commit message.
See also
$ git log -S"FOO"
filters commits according to certain lines in the source code.
$ git log -G"BA*"
filters commits based on regular expressions in the source code.
$ git log -- PATH/TO/FOO.PY
filters the commit history for specific files.
$ git log MAIN ..FEATURE
filters for different commits in different branches, in our case between the branches
main
andfeature
.However, this is not the same as
$ git log FEATURE..MAIN
. Let’s take the following example.A - B main \ C - D feature
$ git log MAIN..FEATURE
shows changes in
FEATURE
that are not contained inMAIN
, that are the commitsC
andD
.$ git log FEATURE..MAIN
shows changes in
MAIN
that are not contained inFEATURE
, that is the commitB
.$ git log MAIN...FEATURE
shows the changes on both sides, the commits
B
,C
andD
.
$ git log --oneline --graph --decorate
Show the history diagram with references, one commit per line.
$ git log REF..
List commits that exist in the current branch and are not merged into
ref
.ref
can be the name of a branch or a tag.$ git log ..REF
List commits that exist in
ref
and are not merged with the current branch.$ git reflog
List operations (for example
switch
,commit
) that have been performed in the local repository.