给匿名分支命名

发布于 2024-10-08 01:43:39 字数 280 浏览 2 评论 0原文

我有一个克隆产生的匿名分支(没有命名的分支,在红色矩形中)。 alt text

我意识到我可以通过书签向匿名分支提供名称,

但是,书签不是永久的。我想知道,我是否可以将匿名分支变成真正的命名分支?这样做是否太晚了?或者我应该在 1)Change calendar to dateTime. 更改的一开始就这样做?

谢谢。

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

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.

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

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

发布评论

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

评论(3

北陌 2024-10-15 01:43:40

当您提交第一个变更集(即您指出的变更集)时,您应该这样做。

分支的名称作为变更集的一部分永久存储,因此在这种情况下,变更集肯定位于分支上,只是它们位于 default 分支上。

追溯地将新分支名称嵌入到变更集中的唯一方法是将变更集一一重放到没有它们的存储库中,然后您将有一个新的机会获取其中的分支名称。

确定要为该分支命名吗?一旦它存在,你就无法摆脱它(不做与将其放入其中相同的练习),所以如果它是暂时的,那么名称就是错误的做法。

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.

酒废 2024-10-15 01:43:40

您无法更改该变更集上的分支名称,但您可以通过添加具有所需分支名称的新提交来命名该分支。从此以后,“hg clone -rbranchname”和“hg diff -rbranchname”等将引用该分支的最新提示。

Lasse 和我自己都曾在其他地方建议您,命名分支对于功能来说并不是一个好主意,它更适合长期存在的事物,例如开发分支(例如:稳定的、实验性的等),但只要您了解命名分支相对于书签和匿名分支的永久性,您可以为功能分支解决方案做出您喜欢的任何决定(就我个人而言,我更喜欢命名克隆中的匿名分支)。

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).

泪痕残 2024-10-15 01:43:40

您可以使用Rebase 扩展

  1. 将工作副本更新为“更新标签”修订版
  2. 创建新分支,例如“新分支”(hg 分支新分支)
  3. 提交它(hg commit --message=我的更改的单独分支)
  4. 重新设置从“将日历更改为日期时间”开始的变更集新提交的顶部。

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文