List the files that were changed between two commits or branches

If you want to do a quick check of what files have changed between two dif­fer­ent com­mits or branches, for exam­ple, to know if you could run into merge con­flicts if you have been mod­i­fy­ing the same file, you can use this nifty lit­tle command.

git diff --name-status commit1SHA commit2SHA

The above com­mand tells you what files in commit2SHA are dif­fer­ent since commit1SHA. You can also use them to com­pare what changes were made within a branch itself. e.g. to know what new files were added/modified/deleted since the past 10 com­mits, you would use

git diff --name-status HEAD~10 HEAD

Ryan Sukale

Ryan is just a regular guy next door trying to manage his life and finances.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *