且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Git分支转移问题和工作流程

更新时间:2022-04-28 03:55:22

upstream的思想是允许您自己的存储库以upstream存储库中的最新存储库为基础.
这样,您可以与上游保持最新,同时将自己的贡献推送到"origin"(这是一个分叉:您拥有的upstream回购的克隆).

The idea of upstream is to allow for your own repo to rebase itself on top of latest from upstream repo.
That way, you can keep up-to-date with upstream, while pushing your own contribution to 'origin' (which is a fork: a clone of upstream repo which you own).

您可以按origin键.您不能推送到upstream(您不是贡献者)
请参阅" upstream?"

You can push to origin. You can't push to upstream (you are not a contributor)
See "What is the difference between origin and upstream in GitHub?"

我建议您使用,因为upstream/master有其自己的历史记录(与您的更改平行)

In your case, I would recommend, since upstream/master has its own history (parallel to your changes)

git checkout rotation
git rebase upstream/master
git push -f origin rotation

请注意,您正在用力推动(即重新创建更改的历史记录)在叉子上origin/rotation:如果尚未从叉子上拉出其他贡献者,那么这应该不是问题.
您在rotation上的工作将基于最新的upstream/master,这将简化

Note that you are force pushing (ie, recreating the history of your changes) on your fork origin/rotation: if no other contributor have already pulled from your fork, this shouldn't be an issue.
And your work on rotation will be based on the latest of upstream/master, which will simplify the future pull request you might want to do.