Resolve Git error: error: You have not ended your merge (MERGE_HEAD exists)

89b807894650ded978e76587aab8e9a6.png

When using Git, you may encounter a common problem: when pushing code, you find an update in the remote repository and execute thegit pullThe auto-merge is triggered at the time of the merge. However, during the merge process, you may for some reason (e.g., in the middle of a merge, press theCtrl+C) exits the merge process, which causes Git to give you a “merge not completed” error, which usually looks like this:

error: 您尚未结束您的合并(存在 MERGE_HEAD)。  
提示:请在合并前先提交您的修改。  
fatal: 因为存在未完成的合并而退出。  

In this article, we will detail how to solve this problem and further analyze the causes of the problem and the role of common commands.