The git diff command is used to perform the
The command below can be used to compare files of different branches.
git diff my_master master -- js/test.js
The code above will show the difference between the test.js files in the my_master and the master branch. The -- command denotes the end of command-line flags. This is optional unless Git gets confused if the argument refers to a commit or a file.
If we want to compare the test.js file from the current branch to the other branch then the current branch name can be skipped by adding ...
git diff ..my_master -- js/test.js
The code above will show the difference between the test.js files in the current branch and the master branch.
Free Resources