Git log: Difference between revisions
Jump to navigation
Jump to search
(10 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
=Overview= | =Overview= | ||
Show [[Git Concepts#Commit|commit]] logs. | Show [[Git Concepts#Commit|commit]] logs. With no arguments, shows the [[#Commit_History_of_the_Current_Branch|commit history of the current branch]]. | ||
Also see: | |||
{{Internal|git rev-list|git rev-list}} | |||
=Commit Limiting= | |||
{{Internal|Git Commit Limiting|Commit Limiting}} | |||
=Use Cases= | =Use Cases= | ||
Line 12: | Line 19: | ||
git log | git log | ||
==Last Log== | |||
<syntaxhighlight lang='bash'> | |||
git log -1 | |||
</syntaxhighlight> | |||
==Commits of a Specific User== | |||
The following command searches only the current commit's ancestors. | |||
git log --author=ovidiu | |||
Note that "ovidiu" will match longer strings that include it and the comparison will be case insensitive. | |||
==Commit History of an Arbitrary Branch== | ==Commit History of an Arbitrary Branch== | ||
Line 19: | Line 39: | ||
git log develop | git log develop | ||
git log origin/develop | git log origin/develop | ||
===Commit History of a File from an Arbitrary Branch=== | |||
git log master -- Casks/vagrant.rb | |||
==Commit with a Specific Message== | |||
Search the current branch: | |||
git log --grep "something" | |||
Search all branches: | |||
git log --all --grep "something" | |||
==Commits (and Logs) Since a Specific Commit== | |||
Excluding the commit: | |||
git rev-list <since_hash>..HEAD | |||
git log <since_hash>..HEAD | |||
Including the commit: | |||
git rev-list <since_hash>^..HEAD | |||
git log <since_hash>^..HEAD | |||
==Commits (and Logs) Between Commits== | |||
git log <since_hash>^..<until_hash> |
Latest revision as of 04:16, 9 July 2021
Internal
Overview
Show commit logs. With no arguments, shows the commit history of the current branch.
Also see:
Commit Limiting
Use Cases
Commit History of the Current Branch
git log
Last Log
git log -1
Commits of a Specific User
The following command searches only the current commit's ancestors.
git log --author=ovidiu
Note that "ovidiu" will match longer strings that include it and the comparison will be case insensitive.
Commit History of an Arbitrary Branch
The branch does not have to be checked out:
git log develop git log origin/develop
Commit History of a File from an Arbitrary Branch
git log master -- Casks/vagrant.rb
Commit with a Specific Message
Search the current branch:
git log --grep "something"
Search all branches:
git log --all --grep "something"
Commits (and Logs) Since a Specific Commit
Excluding the commit:
git rev-list <since_hash>..HEAD git log <since_hash>..HEAD
Including the commit:
git rev-list <since_hash>^..HEAD git log <since_hash>^..HEAD
Commits (and Logs) Between Commits
git log <since_hash>^..<until_hash>