通过变基保持远程存储库同步
我遇到一种情况,我必须将主题分支重新设置为主分支。没关系,这是正常的变基情况并且效果很好。
复杂的是当我试图让这个过程在裸露的远程存储库上同步时。
例如,
o--o--o origin/master \ o--o origin/topic o--o--o clone/master - tracking origin/master \ o--o clone/topic - tracking origin/topic
现在我对克隆/主控进行了提交,并将其推送到原始/主控,到目前为止一切顺利。
o--o--o--n origin/master \ o--o origin/topic o--o--o--n clone/master - tracking origin/master \ o--o clone/topic - tracking origin/topic
这就是我想要结束的地方:
o--o--o--n origin/master \ o--o origin/topic o--o--o--n clone/master - tracking origin/master \ o--o clone/topic - tracking origin/topic
我似乎无法到达那里,请帮忙。
工作流程是:
- 克隆裸露的远程源
- 对克隆/主版本进行更改
- 将更改推送到 origin/master
- 将克隆/主题重新设置为原始或克隆主 - 似乎没有太大区别
- 现在我希望原点/主题能够反映变基,所以我想推送,但首先我必须拉动以使克隆/主题快进,然后我最终进行合并,其中包含来自克隆/主题的所有原始提交以及来自来源/主题位于顶部。
I have a situation where I will have to rebase a topic branch to a master. That's fine, it's the normal rebase case and works great.
The complication is when I'm trying to get this process to be in sync on a bare remote repository.
e.g.
o--o--o origin/master \ o--o origin/topic o--o--o clone/master - tracking origin/master \ o--o clone/topic - tracking origin/topic
Now I make a commit to clone/master which I push to origin/master, so far so good.
o--o--o--n origin/master \ o--o origin/topic o--o--o--n clone/master - tracking origin/master \ o--o clone/topic - tracking origin/topic
This is where I want to end up:
o--o--o--n origin/master \ o--o origin/topic o--o--o--n clone/master - tracking origin/master \ o--o clone/topic - tracking origin/topic
I just can't seem to get there, please help.
The workflow is:
- Clone the bare remote origin
- Make changes to clone/master
- Push changes to origin/master
- Rebase clone/topic to either origin or clone master - doesn't seem to make too much difference
- Now I want the origin/topic to reflect the rebase so I want to push but first I have to pull to make clone/topic fast forward then I end up a merge which has all the original commits from clone/topic with all the commits from origin/topic on top.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会稍微修改您的工作流程,以避免推送 --mirror。
您需要 --force 因为 origin/topic 将更改祖先并且您已禁用快进检查。
I would modify slightly workflow that you have in order to avoid push --mirror.
You need --force because origin/topic will change the ancestor and you have disable fast forward check.
显然,答案是使用 --mirror 标志进行推送。所以现在的工作流程是:
另请注意,除了我自己之外,我不会与任何人共享远程存储库,否则变基对其他开发人员来说是不公平的。
Apparently the answer is to push with the --mirror flag. So now the workflow is:
Also note that I'm not sharing the remote repo with anyone but myself otherwise rebasing wouldn't be fair to the other developers.