How do I squash two non-consecutive commits?

I’m a bit new to the whole rebasing feature within git. Let’s say that I made the following commits:

A -> B -> C -> D

Afterwards, I realize that D contains a fix which depends on some new code added in A, and that these commits belong together. How do I squash A & D together and leave B & C alone?

5 Answers
5

Leave a Comment