I have a bunch of commits in the repo. I want to see a list of files changed between two commits - from SHA1 to SHA2.
What command should I use?
I have a bunch of commits in the repo. I want to see a list of files changed between two commits - from SHA1 to SHA2.
What command should I use?
To supplement @artfulrobot's answer, if you want to show changed files between two branches:
Be careful on precedence. If you place the newer branch first then it would show files as deleted rather than added.
Adding a
grep
can refine things further:That will then show only files added in
myotherbranch
.As artfulrobot said in his answer:
My example:
Add below alias to your
~/.bash_profile
, then run,source ~/.bash_profile
; now anytime you need to see the updated files in the last commit, run,showfiles
from your git repository.The following works well for me:
$ git show --name-only --format=tformat: SHA1..SHA2
It can also be used with a single commit:
git show --name-only --format=tformat: SHA1
which is handy for use in Jenkins where you are provided with a List of changeSet SHA's, and want to iterate over them to see which files have been changed.
This is similar to a couple of the answers above, but using
tformat:
rather thanformat:
removes the separator space between commits.Use git log --pretty=oneline >C:\filename.log
which will log only a oneline (--pretty=oneline) thats the name of the changed file. Also will log all the details to your output file.
Based on
git diff --name-status
I wrote the git-diffview git extension that renders a hierarchical tree view of what changed between two paths.