I am trying to squash some commits using magit. I tried two different approaches choosing different commit ids to pick and squash. Despite the fact that none of them worked out, the error messages varied. Unfortunately, I cannot understand any of them.

I did a gif to show what happens and I put it on github.

How can I solve this? What should I try? Why is this happening?


1 Answer 1


When you squash a commit, it is squashed into the previous non-squashed commit. You're marking the very first commit in the list as a commit to be squashed, so there's no prior non-squashed commit to squash it into. It's a bit like starting a new repository and using git commit --amend before you've made your first commit.

You need:

pick this commit
squash into ^
squash into ^

Note also that Git's rebase listing runs from top-to-bottom chronologically, as opposed to the log which is in reverse-chronological order.

Note that this isn't actually an Emacs/Magit question -- the point of confusion is no different in the standard Git UI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.