Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git cannot squash commits

Tags:

git

rebase

I cannot squash commits with git rebase -i command, getting the following error message.

error: could not apply 3ad5c7b... 

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To check out the original branch and stop rebasing run "git rebase --abort".

What is the error and how to resolve it?

like image 554
Pan Ruochen Avatar asked Jan 25 '13 02:01

Pan Ruochen


People also ask

Should I squash commits or not?

Before you start, keep in mind that you should squash your commits BEFORE you ever push your changes to a remote repository. If you rewrite your history once others have made changes to it, you're asking for trouble… or conflicts.

How do you squash 2 commits together?

If you want to merge the last 2 commits into one and look like a hero, branch off the commit just before you made the last two commits (specified with the relative commit name HEAD~2). That will bring in the changes but not commit them. So just commit them and you're done.


1 Answers

Git failed to merge automatically. Try git mergetool and resolve conflicts, then continue your rebase with git rebase --continue

like image 121
jasir Avatar answered Sep 23 '22 01:09

jasir