Emacs 27.1


I want to squash some my commits.

Here steps:

     1. magit-status (C-M-s)
     2. l (little L)
     3. l (log current)
     4. In the commit history, put the cursor on the oldest of the N commits that we want to squash, and press r(rebase)
     5. i (interactive)
     6. s (squash)  
     7. We can see that the two commits are marked as squash now,
        then we can press C-c C-c to make the squash happen.
        It will prompt you to enter the new commit and also hint 
        you the previous commit messages. Type Add fruits and 
        press C-c C-c

And here screens: enter image description here

enter image description here

enter image description here

And when press C-c C-c I get error:

Press $

  1 git … rebase -i --autostash fedbec4\^
hint: Waiting for your editor to close the file...
Waiting for Emacs...
error: cannot 'squash' without a previous commit
You can fix this with 'git rebase --edit-todo' and then run 'git rebase --continue'.
Or you can abort the rebase with 'git rebase --abort'.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.