moswald
moswald

Reputation: 11677

Is it possible to rebase individual changesets to an earlier point in 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?

Upvotes: 1

Views: 85

Answers (3)

shellholic
shellholic

Reputation: 6114

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

Upvotes: 2

gizmo
gizmo

Reputation: 11909

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.

Upvotes: 0

alexandrul
alexandrul

Reputation: 13266

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

Upvotes: 0

Related Questions