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 different commits or branches, for example, to know if you could run into merge conflicts if you have been modifying the same file, you can use this nifty little command.

git diff --name-status commit1SHA commit2SHA

The above command tells you what files in commit2SHA are different since commit1SHA. You can also use them to compare what changes were made within a branch itself. e.g. to know what new files were added/modified/deleted since the past 10 commits, 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 *