关闭汞分支机构

发布于 2024-09-09 05:35:27 字数 210 浏览 4 评论 0原文

当使用hg分支FeatureBranchName并将其发布到开发人员之间共享的中央存储库时,有没有办法在其开发正式与开发人员合并时最终关闭FeatureBranchName默认分支?

如果执行 hg Branches 命令时 FeatureBranchName 不可见,这也会很有帮助。

When using hg branch FeatureBranchName and publishing it to a central repo that is shared amongst developers, is there a way to eventually close the FeatureBranchName when its development has officially been merged with the default branch?

It would also be helpful if the FeatureBranchName was not visible when performing a hg branches command.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

心碎无痕… 2024-09-16 05:35:28
hg commit --close-branch

应该足以标记分支关闭。 (请参阅 hg 提交

--close-branch

将分支标记为关闭,将其从分支列表中隐藏。

另请参阅此帖子

我的期望是关闭一个分支,因为这条开发线已经走进了死胡同,我不想再被它打扰了。
因此,当一个分支被关闭时,我不应该看到它(例如在分支、头、日志中),除非我明确要求查看关闭的分支。

我应该注意,我希望关闭的分支保留在存储库中;
它将来可能会有用,并且 commit --close-branch 消息
至少应该解释为什么分支被关闭。
修剪分支完全是另一回事。


注意:“关闭分支”业务是 Git 中缺失的一个方面。 ,与 Mercurial 相比:

我们总是被告知,git 中的分支是短暂的东西,需要使用和丢弃,据我所知,git 没有办法向你的同事表明你已经完成了分支;
执行此操作的唯一方法是删除它,或者希望他们看到最终的合并提交并了解该分支已关闭以进一步开发。

[在 Mercurial 中]但是,当您完成分支后,您无法将其从存储库中删除;相反,您发出关闭分支的提交,并且 Mercurial 会注意到该分支已关闭。它将保留在您的存储库历史记录中永久的一部分。

hg commit --close-branch

should be enough to mark a branch close. (see hg commit)

--close-branch

mark a branch as closed, hiding it from the branch list.

See also this thread:

My expectation is that I close a branch because this line of development has come to a dead end, and I don't want to be bothered with it any more.
Therefore, when a branch has been closed I shouldn't see it (in branches, heads, log, for instance) unless I explicitly ask to see closed branches.

I should note that I expect a closed branch to remain in the repository;
it may be useful in the future, and the commit --close-branch message
should at least explain why the branch was closed.
Pruning branches is another thing altogether.


Note: that "closing branch" business is one aspect seen as missing in Git, when compared to Mercurial:

Branches in git are, we’re always told, ephemeral things to be used and thrown away, and so far as I know git doesn’t have a way to indicate to your colleagues that you’re done with a branch;
the only way to do this is to delete it, or to hope they see the final merge commit and understand that the branch is closed to further development.

[In Mercurial] When you’re done with a branch, however, you cannot delete it from the repository; instead, you issue a commit which closes the branch, and Mercurial notes that the branch is closed. It’ll remain a permanent part of your repository history.

萌面超妹 2024-09-16 05:35:28

我编写了一个简单的脚本来完成分支关闭,命令位于 PruningDeadBranches

## 脚本 ##

#!/bin/bash
#script to close the not required branch in mercurial

hg up -C $1
if [ $? -eq 0 ]; then
    echo "$1 is up"
else
    echo "branch not found, please recheck your argument"
    exit 1
fi 
# if we are here then the branch is up, so we do the following
hg commit --close-branch -m 'this branch no longer required' 
echo "$1 is closed"
hg up -C default
echo "default is up" 

如何

移动到存储库的本地副本,并通过给出参数来运行此脚本。例如:

$./the_script_above.sh bad_branch_name_to_close

它做什么

这会执行以下操作:

  1. 如果分支存在,则更新到给定分支,否则存在
    错误消息。
  2. 它关闭了分支。
  3. 更新到默认分支。
  4. 停止。

I wrote a simple script that completes the branch close, commands found at PruningDeadBranches.

## Script ##

#!/bin/bash
#script to close the not required branch in mercurial

hg up -C $1
if [ $? -eq 0 ]; then
    echo "$1 is up"
else
    echo "branch not found, please recheck your argument"
    exit 1
fi 
# if we are here then the branch is up, so we do the following
hg commit --close-branch -m 'this branch no longer required' 
echo "$1 is closed"
hg up -C default
echo "default is up" 

How to

Move to the local copy of the repository, and run this script by giving an argument. For example:

$./the_script_above.sh bad_branch_name_to_close

What does it do

This does the following:

  1. If the branch exists, it updates to the given branch or else exists with
    an error message.
  2. It closes the branch.
  3. Updates to the default branch.
  4. Stops.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文