开发者

Give name to an anonymous branch

I had an anonymous branch (branch without naming, in red rectangle) result from cloning.

Give name to an anonymous branch

I realize I may provide name to开发者_开发百科 the anonymous branch through bookmarking

However, bookmarking is not permanent. I was wondering, whether I can make the anonymous branch to truly named branch? Is it too late to do so? Or I should do it in the very beginning of 1)Change calendar to dateTime. change?

Thanks.


You should've done that when you committed the first changeset, the one you point out.

The name of a branch is permanently stored as part of the changeset, so in this case, the changesets are definitely on a branch, it's just that they're on the default branch.

The only way to retroactively embed a new branch name into the changesets is to replay the changesets one by one into a repository that doesn't have them, you would then get a new chance of getting the name of the branch in there.

Are you sure you want to name the branch? You can't get rid of it (without doing the same excercise as getting it in there) once it is there, so if it is temporary, a name is the wrong thing to do.


You can't change the branch name on that changeset, but you can name the branch by just adding a new commit with the branch name you want. Henceforth 'hg clone -r branchname' and 'hg diff -r branchname' and the like will refer to that branch's latest tip.

You've been elsewhere advised by both Lasse and myself that named branches aren't a great idea for features, being better suited for long-lived things like branches of development (ex: stable, expirimental etc.) but so long as you understand the permanence of named branches relative to bookmarks and anonymous branches you can make whichever decision you like for your feature branching solution (personally, I prefer anonymous branches in named clones).


You can use Rebase extension.

  1. Update working copy to "update tag" revision
  2. Create new branch e.g "new branch" (hg branch new branch)
  3. Commit it (hg commit --message=Separate branch for my changes)
  4. Rebase the changesets starting from "Change calendar to dateTime" on top of new commit.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜