0

What I have is: A -> B -> C -> D

My aim is to get 2 commits like A+C and B+D. What I am thinking is:

git rebase -i HEAD~3

Making the commits

pick A
squash C
pick B
pick D

Now, I will move the head back

git reset --soft HEAD~2 

If I understand correctly this should move the head to B. So I can do:

git rebase -i HEAD~2

pick B
s D

And finally I move back the head with:

git rebase -i HEAD~1

And I am done. Is this a possible/reasonable solution?

I have found ways to squash 2 commits here - How do I squash two non-consecutive commits?.

NiRvanA
  • 105
  • 1
  • 1
  • 8

0 Answers0