How to show git log history (i.e., all the related commits) for a sub directory of a git repo?

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

if you want to see it graphically you can use

gitk -- foo/A

enter image description here


Enter

git log .

from the specific directory, it also gives commits in that directory.

Tags:

Git