`git log` command is used to view the commit history and display the necessary information of the git repository. This command displays the latest git commits information in chronological order, and the last commit will be displayed first.
The git log command displays all of the commits in a repository's history.
On GitHub, you can see the commit history of a repository by: Navigating directly to the commits page of a repository. Clicking on a file, then clicking History, to get to the commit history for a specific file.
From directory foo/
, use
git log -- A
You need the '--' to separate <path>..
from the <since>..<until>
refspecs.
# Show changes for src/nvfs
$ git log --oneline -- src/nvfs
d6f6b3b Changes for Mac OS X
803fcc3 Initial Commit
# Show all changes (one additional commit besides in src/nvfs).
$ git log --oneline
d6f6b3b Changes for Mac OS X
96cbb79 gitignore
803fcc3 Initial Commit
Enter
git log .
from the specific directory. It also gives commits in that directory.
If you want to see it graphically you can use gitk:
gitk -- foo/A
You can use git log
with the pathnames of the respective folders:
git log A B
The log will only show commits made in A
and B
. I usually throw in --stat
to make things a little prettier, which helps for quick commit reviews.
The other answers only show the changed files.
git log -p DIR
is very useful, if you need the full diff of all changed files in a specific subdirectory.
Example: Show all detailed changes in a specific version range
git log -p 8a5fb..HEAD -- A B
commit 62ad8c5d
Author: Scott Tiger
Date: Mon Nov 27 14:25:29 2017 +0100
My comment
...
@@ -216,6 +216,10 @@ public class MyClass {
+ Added
- Deleted
For tracking changes to a folder where the folder was moved, I started using:
git rev-list --all --pretty=oneline -- "*/foo/subfoo/*"
This isn't perfect as it will grab other folders with the same name, but if it is unique, then it seems to work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With