强制创建 Mercurial 远程头(即分支)是个坏主意?
我正在开发一个集中式 Web 应用程序,并且我有一个集中式 Mercurial 存储库。
我在本地的存储库中创建了一个分支,
hg branch my_branch
然后进行了一些更改并提交。然后当我尝试推送时,我发现
abort: push creates new remote branch 'my_branch'!
(did you forget to merge? use push -f to force)
我刚刚使用了push -f。这很糟糕吗?我希望在我的中央远程存储库中有多个分支,因为我想 1) 备份我的工作,2) 允许其他开发人员在该分支上与我一起开发。
在我的远程存储库中有分支是坏事还是什么?我不应该做push -f(如果不做,我应该做什么?)?为什么 Joel 在他的教程中这么说:
(来源:grabby.info)
有时我会进行更改一个分支,推送,切换到另一个分支,我在切换到的那个分支中所做的更改神秘地从几次提交之前恢复到以前的版本。也许这是强行推动的症状?
I am developing a centralized web application, and I have a centralized Mercurial repository.
Locally I created a branch in my repository
hg branch my_branch
I then made some changes and committed. Then when I try to push, I get
abort: push creates new remote branch 'my_branch'!
(did you forget to merge? use push -f to force)
I've just been using push -f. Is this bad? I WANT multiple branches in my central, remote repository, as I want to 1) back up my work and 2) allow other developers to develop with me on that branch.
Is it bad or something to have branches in my remote repository or something? Should I not be doing push -f (and if not, what should I do?)? Why does Joel say this in his tutorial:
(source: grabby.info)
Occasionally I've made a change in a branch, pushed, switched to another branch, and changes I had made in that branch I switch to were mysteriously reverted to a previous version from several commits ago. Maybe this is a symptom of forcing a push?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我怀疑其他有更多时间的人可以更好地回答,但这是我发现的相关内容:
https://www.mercurial-scm.org/wiki/TipsAndTricks#Prevent_a_push_that_would_create_multiple_heads
它与一个不同的选项有关(特别是破坏 Push -f),但它提到了与您所要求的内容类似的内容:
假设这是一个准确的陈述,那么您这样做是完全安全的。
但请注意,我只有 Mercurial 的基本知识,因此不应用作完整事实的来源:)。
My suspicion is that others with more time can answer better, but here is something related I found:
https://www.mercurial-scm.org/wiki/TipsAndTricks#Prevent_a_push_that_would_create_multiple_heads
It is related to a different option (specifically breaking push -f), but it mentions something along the lines of what you ask:
Assuming this is an accurate statement then you are perfectly safe to do so.
Note however that I have only basic knowledge in Mercurial so shouldn't be used as a source of complete truth :).
不,创建新分支时强制推送也不错。发出错误/警告是因为新分支导致存储库有两个拓扑头。也就是说,现在有两个没有子项的变更集:默认分支的提示和新分支的提示。
使用 Mercurial 1.6(将在两周内发布),您将能够
创建新的远程分支。这更安全,因为
--force
禁用所有安全防护,而--new-branch
只允许您创建新分支。No, it's not bad to force the push when you create a new branch. The error/warning is issued because the new branch causes the repository to have two topological heads. That is, there are now two changesets without children: the tip of your default branch, and the tip of your new branch.
With Mercurial 1.6 (to be released in two weeks time) you will be able to do
to allow the creation of new remote branches. This is safer since
--force
disables all safety guards, whereas--new-branch
only allows you to create a new branch.