How to only push to one branch in Hg?

后端 未结 3 1441
梦谈多话
梦谈多话 2021-01-30 05:21

I have a Hg repo with 3 branches in it, but two of them are inactive (since I have already merged them into my default branch). hg heads shows 3 heads, one for each bra

3条回答
  •  长情又很酷
    2021-01-30 05:29

    If changesets on default have ancestor changesets on other branchs you have to push those changesets too. It's not possible for a changeset to exist in a repo without all of its changesets also existing.

    So try:

    hg push --branch default --new-branch
    

    which says "yeah, I know this push sends across a branch name that the remote repo hasn't previously seen before" (it also requires Mercurial 1.6 or later IIRC)>

    Also, you can take those inactive heads and make them closed heads with:

    hg update thebranch
    hg commit --close-branch -m 'closing'
    

    Because "named branches are forever" many folks choose to reserve them for long lived concepts like "stable" and "experimental" and use bookmarks, anonymous branches, or clones for features, releases, and other transitory things. See this for a guide on those other options.

提交回复
热议问题