为什么需要--new-branch标志? [英] Why is a --new-branch flag needed?

查看:66
本文介绍了为什么需要--new-branch标志?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这不是正常的工作流程吗?

Isn't this a normal workflow?

[default] $ hg branch foo

[foo] $ [... some commits ...]

[foo] $ hg update default

[default] $ hg merge foo

[default] $ hg commit -m "merged foo"

[default] $ hg push
abort: push creates new remote branches: foo!
(use 'hg push --new-branch' to create new remote branches)

否则,进行分支→合并→推送的理想方法是什么?

What is the otherwise ideal way to do branching → merging → pushing?

推荐答案

善变的哲学是,您不应推行会使存储库的其他用户更难的事情.与这个问题相关的是,多个负责人会使其他开发人员更难,因为他们随后将需要合并您的更改.因此,默认情况下,服务器拒绝推入新磁头. -f选项用于允许推入新的磁头.

The mercurial philosophy is that you should not be pushing things which make it harder for other users of the repository. Relevant to this question is that multiple heads make it harder for other developers, since they would then need to merge your changes. Hence by default pushing new heads is rejected by the server. The -f option was used to allow pushing new heads.

但是,从概念上讲,推入一个新的命名分支与在同一分支上推入一个新的头有很大的不同.许多工作流程(包括我的工作流程)在单独的命名分支上完成每个任务. --new-branch选项允许您上推新分支,同时拒绝现有分支上的新标头.它也有所不同(如您所见),因为即使新分支没有创建新的标头(由于合并),它也是必需的.

However, the case of pushing a new named branch is quite different conceptually to pushing a new head on the same branch. Many workflows (including mine) do each task on a separate named branch. The --new-branch option allows you to push up a new branch, whilst rejecting new heads on existing branches. It's also different (as you've seen) because it's needed even if the new branch does not create a new head (due to merging).

我个人的感觉是,默认情况下应允许新的分支机构,但专业开发商则相反.

My personal feeling is that new branches should be allowed by default, but the mercurial developers prefer otherwise.

这篇关于为什么需要--new-branch标志?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆