How can I keep my fork in sync without adding a separate remote?

后端 未结 7 1223
孤独总比滥情好
孤独总比滥情好 2020-12-04 04:06

Let\'s assume there is a repository someone/foobar on GitHub, which I forked to me/foobar.

How do I pull new commits from

7条回答
  •  醉话见心
    2020-12-04 04:46

    git remote set-url origin git@github.com:someone/foobar
    git remote set-url origin --push git@github.com:me/foobar
    

    There is one caveat though:
    This is perfect if you are the only one making changes to your fork.
    However, if it is shared with other people, you may have to pull from your fork, in which case a separate remote is the only solution.

    Edit:
    Actually, you can git pull git@github.com:me/foobar, which removes the caveat.
    The choice is yours as to which is easier to remember.

提交回复
热议问题