git diff - show only what's new on the remote

前端 未结 3 1641
自闭症患者
自闭症患者 2021-02-20 13:24

I have a local repo and a remote repo on github. For business reasons, they aren\'t in sync. I\'ve done a lot of work on the local that I\'m keeping, and now I\'m manually add

相关标签:
3条回答
  • 2021-02-20 14:03

    You can diff with the common ancestor:

    git diff `git merge-base master origin/master` origin/master
    

    Or with your previous fetch:

    git diff origin/master@{1} origin/master
    
    0 讨论(0)
  • 2021-02-20 14:20

    I believe you can put 3 dots between the two branches in the command and then it does only whats new in the second with respect to the first, i.e.

    git diff master...feature
    

    to see what's new on feature, and

    git diff feature...master
    

    to see what's new on master. In your case feature can be origin/master and that should work fine.

    0 讨论(0)
  • Try looking at git help rev-list. The option you are probably looking for is --right-only, so maybe this gets you what you want:

    git diff --color --right-only master..origin/master
    
    0 讨论(0)
提交回复
热议问题