Failed to squash. Should be done manually

Hi

In the last week or so, one of our repos keeps getting an error message when attempting to merge a MR “Failed to squash. Should be done manually” and it happens now on every MR even when it is just 2 commits. Never seen this before on any of our projects and it only seems to happen on the 1 project and on ever single MR. An I am the only contributor so master has not changed.

Has anyone else seen this issue and know how to resolve it?

Thanks

3 Likes

Yes, this is happening to us as well.

Funny enough, the response from their merge endpoint is: {"status":"success"}

The MR will succeed if you uncheck the squash option. Hopefully this get’s fixed or someone finds more out.

I don’t even know who I’m asking for an update on this, but has anything been learned?

I have also experienced this problem when merging MRs that were opened before a lot of line endings were changed in a repository.

I have found that the MRs can be merged after manually rewriting history by:

git checkout <branch>
git reset origin/<branch>
git add .
git commit -m <message>
git push -f

It is not a nice solution, but it works.

We’re having similar issue, it’s being discussed here: Got "Failure to squash" error when trying to merge an MR that had 1 commit (#27046) · Issues · GitLab.org / GitLab · GitLab

I went with the re-writing history approach and manually selected which commits to squash and a new message:

git checkout <branch>
git rebase -i HEAD~3
-> choose which commits to squash and message(s) to edit
-> finalize your commit message(s)
git push -f

Hope this helps until the commit mentioned here gets rolled out: operations: Implement squashing without worktrees (!3657) · Merge requests · GitLab.org / gitaly · GitLab

looks like also this instead of my manually version: rebase - How to squash all git commits into one? - Stack Overflow

(git rebase reference: Git - Rewriting History)

This is happening to us as well.

We had the same issue once last week.

Had this issue happen to me today,

the fix : merge the branch you are trying to merge this branch to in this branch first then you can merge

ELI5: if i want to merge product into dev , but error happens , i merge dev into product first , then i merge product into dev

2 Likes