0

I have a stack of git commits from oldest to newest:

com1
com2
com3

I want to modify something in com1 and have to propagate to com2 and com3. I would like to use interactive rebase. When I interactive rebase, should I select to edit just com1, or should I mark com2 and com3 as edit as well since I want the changes to be propagated? If I don't mark com2 and com3 as edit, what will happen, and does the answer change if there's a merge conflict or not?

  • 2
    just edit the first one, then each commit will be applied, and if there is a conflict this will stop to allow you to edit – Ôrel Mar 07 '22 at 15:29
  • @Ôrel Got it thanks. If I edit just the first one, do I have to git amend the others, or will it be automatically applied to the others? (maybe I'm asking the same question as the OP here. I'm not too well versed with rebasing) – westcoaststudent Mar 07 '22 at 15:40
  • 1
    Just change the commits you want to change. Have a try and you will see. – Ôrel Mar 07 '22 at 16:04
  • 2
    @westcoaststudent it will definitely *try* to "propagate" like you want. Rebasing replays the diffs between commits, so if you modify `com1` to also do X, since neither `com2` or `com3` will "undo X" (because they don't "know" about X), that change will remain. Or, depending on what X is, it's possible `com2` or `com3` will try to do something that conflicts with X, in which case the rebase will pause and ask you for help. – TTT Mar 07 '22 at 16:24

0 Answers0