How can I compare my local forked repository with changes that may have been made to the original?

前端 未结 1 1462
既然无缘
既然无缘 2021-02-20 00:01

I want to compare the local clone of a repository I have forked with the original/upstream repository to see if further commits have been made requiring me to pull/merge. I\'d l

相关标签:
1条回答
  • 2021-02-20 01:01

    Before one can run a git diff between one's own local repo and the upstream, one must first fetch the upstream repo. The comparison is then made locally.

    git fetch upstream
    

    This does not affect the working branch of your repo but it does add a whole other bunch of "remote" branches, which you can see with git branch -a.

    Once you've got those, use:

    git diff master upstream/master
    

    This will compare the local repository you have with any updates that have been made to the original repository. Variations on this command will deal with updates you may have made to your own branch or check against a common ancestor (e.g., git diff master...upstream/master) as usual.

    0 讨论(0)
提交回复
热议问题