how to omit a commit while squashing

Viewed 1608

I have 3 commits and i want to skip a commit -2 while rebasing into 1 say

commit -1
commit -2 
commit -3

i did git rebase -i HEAD~3

pick commit -1
pick commit -2
squash commit -3

i tried like this (removed the pick commit -2) but that deleted the commit -2 itself from git log :(

git rebase -i HEAD~3
pick commit -1
squash commit -3

Someone please help me how can i squash commit 1 and commit 3 using command only.

3 Answers
Related