Git – show all files modified between two commits
It’s always best to commit your work only once it’s done. Sometimes the changes span over days or weeks and this is where stashing comes useful. Sometimes, however, I start work at the office and then I want to go on at home in the evening. So I commit the half-done changes to the dev branch, push it to the origin and check it out at home again. Once the work is done and ready to be deployed, I need to see what files have been modified. If there was only one commit, it would be easy, but since the work spans over several commits, I need a list of all files:
git diff --name-only SHA1 SHA2
SHA1 and SHA2 are the hashes of the two commits. You can get them displayed using:
git log
or to get a better format:
git log --graph --date-order -C -M --pretty=format:"<%h> %ad [%an] %Cgreen%d%Creset %s" --all --date=short