1

I am trying to wrap my head around git and rebaseing commits. I understand how to take sequential commits and roll them up into one. However I am having a hard time figuring out how to roll separate commits into each other if they were not done in order.

Here is my interactive rebase:

pick 3327473e2 feature 1
pick 6f8b6bb5e feature 2
pick 440f987b0 my update to feature 2
pick 8b7d09e70 my update to feature 1

I am wanting to merge commit 8b7d09e70 into feature 1's commit. And I am wanting to merge 8b7d09e70 into feature 2's commit.

mike
  • 1,239
  • 1
  • 14
  • 32
Johnrad
  • 2,619
  • 17
  • 56
  • 93

1 Answers1

2

Simply reorder the lines.

pick 3327473e2 feature 1
pick 8b7d09e70 my update to feature 1
pick 6f8b6bb5e feature 2
pick 440f987b0 my update to feature 2

Then change them to squash or fixup:

pick 3327473e2 feature 1
fixup 8b7d09e70 my update to feature 1
pick 6f8b6bb5e feature 2
fixup 440f987b0 my update to feature 2
Jonathon Reinhart
  • 124,861
  • 31
  • 240
  • 314