如何在分叉的github回购中更新我的新分支 [英] How to update my new branch in a forked github repo
问题描述
我在github上公布了一个回购协议,做了一些修改。我创建了一个新分支并在那里实施了我的更改。现在我想从上游repo获取新的提交,但是我只能将上游提交同步到我的master repo而不是新分支。如何同步从上游到我的新分支而不是主分支?
I forked a public repo on github to do some changes. I created a new branch and implemented my changes there. Now I want to get the new commits from the upstream repo, but I was just able to sync the upstream commits to my master repo not to the new branch. How do I sync from upstream to my new branch instead of master?
推荐答案
如何同步从上游到我的新分支,而不是主?
您应该同步 master $ c $首先,然后在新更新的
master
之上重新绑定您的分支。
You are supposed to sync master
first, then rebase your branch on top of the newly updated master
.
git pull upstream master
git checkout yourBranch
git rebase master
git push -f origin yourBranch
假设你有一个名为' upstream
'的远程引用原始回购站(你已经分出)的URL
That supposes you have a remote named 'upstream
' referring to the url of the original repo (that you have forked)
请参阅将原始Github存储库的新更新引入分叉的Github存储库为 git remote add upstream
命令示例。
这篇关于如何在分叉的github回购中更新我的新分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!