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.
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.
To merge two branches, you pull their heads into the same repository, update to one of them and merge the other, and then commit the result once you're happy with the merge.
Closing branches should not by themselves prevent you from pushing. A closed branch is simply a branch that ends in a commit that carries the "closed branch" meta information.
You can just hg update to the closed branch then do another hg commit and it will automatically reopen.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With