There is a basic question about revision compare in git. I can compare current version with original version with
git diff HEAD^ HEAD
However, I need compare current version (origin/master
) with current version of same branch on git server. It was pushed after get my original version. I tried to compare via commit id (got from web gitlab interface). However, there was the following error:
$ git difftool 866f426ce3c4d7594500ce322b68fd1d96ced06b
fatal: bad object 866f426ce3c4d7594500ce322b68fd1d96ced06b
There is an advice to use
git diff masterbranch remotebranch
For my case it looks like:
git diff master origin/master
In this case the diff is a comparison current version with original version I got as start for my changes. However, this branch was changed later. I would like to compare my version with actual state of branch origin/master
not original one I used.
2 ways to do that:
directly diff with the remote server (need to be connected):
git diff masterbranch remotebranch
for instance
git diff master origin
Grab the code and diff localy :