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

后端 未结 7 1172
孤独总比滥情好
孤独总比滥情好 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 05:09

    I don't know how it can be done without adding another remote, however I always add the repo I forked from as the upstream remote so I could simply do:

    git branch -a|grep remotes/upstream| while IFS="/" read p r b; do echo Syncing $r/$b to origin/$b; git push origin $r/$b:refs/heads/$b; done
    

    This will sync all branches incl. creating new ones (remove the refs/heads/ to only update existing branches). If any of your branches has diverged it will throw an error for that branch.

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