I would like to obtain a list of files from a git repository that have been modified or created within a range of commits. Is this possible? I've taken a look at log
but it doesn't seem to achieve this.
Find what file changed in a commit To find out which files changed in a given commit, use the git log --raw command.
You can run the git diff HEAD command to compare the both staged and unstaged changes with your last commit.
git diff --name-only ${range}
will give you exactly what you want: only the names of files modified in this time.
Actually, it gives you almost what you asked for: this would include files that were completely deleted, not just modified files. It would also miss files that were created, then removed, within the range.
To get the complete picture you would probably want to walk the range and then uniq the results; use git log
to get the range of commits, then diff each against the parent.
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