Or little computing tricks and hacks
git: comparing with remote branches
October 19, 2015Posted by on
git works with branches so the comparison I want to make, takes place between branches, regardless of where they are located.
To lists local and remote branches, run the command:
git branch -a
The output for my app looks something like this:
... master remotes/origin/master remotes/heroku/master remotes/staging/master ...
The first line is the local working branch, the second in the remote master branch in bitbucket, the last two lines are the production and staging branches in heroku.
I can simply run git diff with the name of the two branches to get a detail description, line by line, of the differences:
git diff remotes/heroku/master remotes/staging/master
To get the list of only the files that are different, use the following command:
git diff --stat --color master remotes/heroku/master