最近我从SVN转到了Mercurial。现在,我想知道如何根据良好的实践在Mercurial中实现我想要的分支工作流,希望其他开发人员理解存储库中发生的事情。
以下是工作流程:
我的问题不是这个工作流程是不是一个好的工作流程(我想它从根本上来说并不是错误的)。我的问题是,我在Mercurial中认识到这一点的方式是否可以被视为良好的实践,或者是否存在更好的机会。
下面是我计划如何在Mercurial中管理分支。
从具有单个分支的存储库开始,该分支包含当前版本系列1.x的代码:
$ hg init
$ echo "hello world" > file1.txt
$ hg ci -A -m "Initial commit of 1.x code"开始使用版本2.x:
$ hg branch 2.x
$ hg ci -m "Create new branch for 2.x development"
$ echo "Big new feature for 2.x" > file2.txt
$ hg ci -A -m "Add big new feature"同时,在当前版本系列(1.x)中做一些工作:
$ hg up default
$ echo "Minor adjustments specific for 1.x" > file3.txt
$ hg ci -A -m "Minor adjustments"过了一段时间,2.0版本准备好了,太棒了!将默认分支设置为1.x和2.x作为默认分支
$ hg up default
$ hg branch 1.x
$ hg ci -m "Make default branch to 1.x branch"
$ hg up 2.x
$ hg ci --close-branch -m "Close branch 2.x"
$ hg branch --force default
$ hg ci -m "Make former 2.x branch to new default"现在创建一个新的分支3.x并在其中工作,也可以在默认情况下工作。再过一段时间,3.0已经准备好了,又到了管理分支名称的时候了:
$ hg up default
$ hg branch --force 2.x # (reuse previously closed 2.x branch name)
$ hg ci -m "Make default branch to 2.x branch"
$ hg up 3.x
$ hg ci --close-branch -m "Close branch 3.x"
$ hg branch --force default
$ hg ci -m "Make former 3.x branch to new default"repo现在可能看起来像这样('o‘是头):
o Branch default (3.x)
|
| o Branch 2.x
 \|
  | o Branch 1.x
   \|
    |
    .我不确定的主要问题是,重用分支名称并同时使用默认分支名称是否是一种好的做法。
这个问题有很多文本-对不起-但我想弄清楚我在做什么。
https://stackoverflow.com/questions/1405604
复制相似问题