开发者

Is it possible to rebase individual changesets to an earlier point in history?

开发者 https://www.devze.com 2023-02-19 03:05 出处:网络
Here\'s what our tree looks like right now: @ branch: default new feature work o branch: default new feature work

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 b开发者_如何学运维ranch: 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?


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


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


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.

0

精彩评论

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