Consider the following git history:
* 21f05f9 - Fifth commit
* 0534049 - Fourth commit
* 738ae0a - Third commit
* 288ffd2 - Second commit
* 2535dca - First commit
How would I combine 21f05f9
738ae0a
and 2535dca
into one commit?
I have tried git rebase -i 2535dca
, pick
ing 2535dca
and squash
ing 21f05f9
and 738ae0a
, but I was given the following error:
error: could not apply 21f05f9 ... Fifth commit
I'm not sure if there's a way to skip commits 0534049
and 288ffd2
within rebase's interactive mode.
Is there a better way to do what I am doing? Are there any pitfalls?
Edit:
What I'm beginning to understand is I shouldn't really put myself in a place where non-linear commits are needed, especially if those commits all relate to one file. I could see an instance where a commit could break code or give a conflict.