fatal --You are in the middle of a merge -- cannot amend 如何解决

在本地分支
1、git stash 将修改的文件保存下来

2、git reset --merge 取消合并

3、git rebase 重新定位到和追踪分支相同的基准。

如果 3 有冲突
1)解决冲突 
2)git add + 文件
3)git rebase (--continue) 

4、git stash pop 将保存文件弹出

如果4 有冲突
1)解决冲突
2)git add + 文件

5、git commit --amend

6、git push -f

原文地址:https://www.cnblogs.com/Smarc/p/14149613.html