Compare committed revision with server one for the same branch

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 :

  • do a fetch (the syntax is the same as git pull, but it doesn't automatically merge)
  • do a diff between your dest branch and the other branch
  • then do a merge if you want
  • 链接地址: http://www.djcxy.com/p/7574.html

    上一篇: 只使用jQuery UI制作屏幕模式的一部分

    下一篇: 将提交的修订与服务器1进行比较,以获取同一分支