I'm trying to use git log to look through the commit history and figure out, given a period of time, how many commits touched certain sub-folders of the codebase.
Maybe there is a tool out there that reports this sort of statistics. But I feel like this should be possible as a one-liner or short script of commands.
I'm on Windows, but a unix friendly script would be great.
The easy way to get the number of commits that touched a files is to just look at the log for that file.
git log --follow -- path/to/my/file
--follow will follow renames, and the
-- is there in case the file path is ambiguous (and looks like a branch name or something).
You can count the results with:
git log --format=oneline --follow -- _exec.sh | wc -l
The total number of commits is given by:
git rev-list HEAD | wc -l
These commands will look at the current branch (and its ancestors) only, you can look at stats for all branches by passing
--all to both