是否可以将各个变更集重新设置为历史上较早的时间点?

发布于 2024-10-26 02:41:49 字数 716 浏览 4 评论 0原文

这是我们的树现在的样子:

@ branch: default
| new feature work
|
|
o branch: default
| new feature work
|
|
o branch: default
| bug fix C
|
|
o branch: default
| bug fix B
|
|
o branch: default
| new feature work
|
|
o branch: default
| bug fix A
|
|
o branch: default
| tag: ReleaseV1.0
|
|
 ... ancient history

这是我希望我们的树的样子:

@ branch: default
| new feature work
|
|
o branch: default
| new feature work
|
|
o branch: default
| new feature work
|
|
|
| o branch: V1.1Fixes
| | bug fix C
| |
| |
| o branch: V1.1Fixes
| | bug fix B
| |
| |
| |
| o branch: V1.1Fixes
| | bug fix A
| |
|/
o branch: default
| tag: ReleaseV1.0
|
|
 ... ancient history

这可能吗?

Here's what our tree looks like right now:

@ branch: default
| new feature work
|
|
o branch: default
| new feature work
|
|
o branch: default
| bug fix C
|
|
o branch: default
| bug fix B
|
|
o branch: default
| new feature work
|
|
o branch: default
| bug fix A
|
|
o branch: default
| tag: ReleaseV1.0
|
|
 ... ancient history

Here's what I'd like our tree to look like:

@ branch: default
| new feature work
|
|
o branch: default
| new feature work
|
|
o branch: default
| new feature work
|
|
|
| o branch: V1.1Fixes
| | bug fix C
| |
| |
| o branch: V1.1Fixes
| | bug fix B
| |
| |
| |
| o branch: V1.1Fixes
| | bug fix A
| |
|/
o branch: default
| tag: ReleaseV1.0
|
|
 ... ancient history

Is this possible?

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

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

发布评论

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

评论(3

烟燃烟灭 2024-11-02 02:41:49

在这种情况下,我将使用 transplant 扩展。移植的变更集不会移入 fixes 分支,而是保留在开发(default)分支中。我不太猜测那些“新功能工作”提交是什么,但我闻到你正在尝试移植

如果不删除“新功能工作”提交,历史记录图将如下所示:

  o branch: V1.1Fixes
  | transplanted bug fix C
  |
  |
@ | branch: default
| | new feature work
| |
| |
| o branch: V1.1Fixes
| | transplanted bug fix B
| |
| |
o | branch: default
| | new feature work
| |
| |
o | branch: default
| | bug fix C
| |
| |
o | branch: default
| | bug fix B
| |
| |
| o branch: V1.1Fixes
| | transplanted bug fix A
| |
| |
o | branch: default
| | new feature work
| |
| |
o | branch: default
| | bug fix A
| |
|/
o branch: default
| tag: ReleaseV1.0
|
|
 ... ancient history

如果这些“新功能工作”提交只是虚拟标志提交以保留开发树中的更改,则您不再需要它们了移植。我保留它们,就好像它们是一些开发后文档、变更日志更新……

In this case, I would use the transplant extension. Transplanted changesets don't move in the fixes branch but also stay in the development (default) branch. I don't really guess what are those "new feature work" commits, but I smell that you are trying to transplant.

Not removing your "new feature work" commits, the history graph would look like that:

  o branch: V1.1Fixes
  | transplanted bug fix C
  |
  |
@ | branch: default
| | new feature work
| |
| |
| o branch: V1.1Fixes
| | transplanted bug fix B
| |
| |
o | branch: default
| | new feature work
| |
| |
o | branch: default
| | bug fix C
| |
| |
o | branch: default
| | bug fix B
| |
| |
| o branch: V1.1Fixes
| | transplanted bug fix A
| |
| |
o | branch: default
| | new feature work
| |
| |
o | branch: default
| | bug fix A
| |
|/
o branch: default
| tag: ReleaseV1.0
|
|
 ... ancient history

If those "new feature work" commit are just dummy flag-commits to retain the changes in the development tree, you don't need them anymore if you transplant. I kept them as if they were some after-development documentation, changelog update,...

拿命拼未来 2024-11-02 02:41:49

查看 RebaseProject变基扩展。您还可以使用移植扩展将补丁从一个分支应用到一个或多个其他分支(以得到类似于 Django 历史记录的内容)。

Take a look at RebaseProject and Rebase Extension. You may also use Transplant Extension to apply a patch from a branch to one or more other braches (to get something similar to what Django history looks).

情独悲 2024-11-02 02:41:49

是的,这是可能的(只要新功能不依赖于错误修复变更集所做的更改),但不建议这样做。
通过在 MQ 中导入变更集,直至标记 ReleaseV1.0,然后在正确的分支上重新提交,可以很容易地实现这一点。
但是,请记住,这样做会更改历史记录,这意味着这些变更集的所有哈希都将被修改,这意味着您将搞砸所有已经拉取最新更改的用户。

Yes, it is possible (as long as the new features does not depends on changes made on bug fix changesets), but it is not recommended.
This can be quite easily achieved by importing your changesets in MQ, up to tag ReleaseV1.0 and then re-commit then on the correct branch.
However, keep in mind that doing so, you'll change the history, which means that all the hashes of these changesets will be modified, which means that you'll screw all the users that have already pulled your latest changes.

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