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,233
  • 1
  • 15
  • 36
Johnrad
  • 2,637
  • 18
  • 58
  • 98

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
  • 132,704
  • 33
  • 254
  • 328