View Git History for Folder

How can I view git log history for all files within a folder ?

I have found several posts on how to show log for a specific file, but haven't found for a specific folder.

2 Answers

You can use either foldername or foldername/*. Either way should work.

git log -- path/to/folder
git log -- path/to/folder/*

History of renamed files will not be followed with this method.

Please note that -- is optional as well. (from git log manual)

[--] <path>...

           Show only commits that are enough to explain how the files that match the specified paths came to be. 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.
5

if you want to use a graphic tool, such as gitk, it works the same:

gitk -- path/to/folder
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest