git error: Pull is not possible because you have unmerged files solution.

Just finished writing the code git push time of submission, warehouse changes, so I git pull , but after the pull print an error message

spider-man@ubuntu:~/APUE-study/LuXiaoyang$ git pull
D       LHJ/.keep
A       LeiHaoJie/.keep
A       LeiHaoJie/hello.c
A       LeiHaoJie/socket_server_thread.c
U       LuXiaoyang/ch1/connet_by_hostname.c
A       LuXiaoyang/ch1/my.c
A       Wangruijie/daemon.c
A       Wangruijie/socket_server_thread.c
A       ZYN/socket_server.c
A       ZhangYinan/database_module_test.c
A       ZhangYinan/db_in.c
A       ZhangYinan/shared_mem_write.c
A       chenxiaohong/ch3/fork.c
A       chenxiaohong/ch3/fork_exec.c
A       chenxiaohong/ch3/fork_var.c
A       chenxiaohong/ch3/popen.c
A       chenxiaohong/ch3/socket_server.c
A       chenxiaohong/ch4/.keep
A       xuxinhua/apue/select.c
A       xuxinhua/wenduchuangan/ds18b20.c
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.

It turned out that in the course of git pull, if there is a conflict, then in addition to file conflicts, other files are saved as files staged area up.

Local push and merge form MERGE-HEAD (FETCH-HEAD), HEAD (PUSH-HEAD) such reference. HEAD quote form after recent successful push of local representatives. MERGE-HEAD represented referenced formed after successful pull.

Solution

The local file conflicts obliterated, not only need to reset or MERGE-HEAD HEAD, also need -hard. No back hard, will not wash away the local workspace. Only flush stage area. Note that when you use the first command, the first local write code just a copy, and then execute the command;

 git reset --hard FETCH_HEAD
 
 git pull就会成功。
Released eight original articles · won praise 11 · views 301

Guess you like

Origin blog.csdn.net/weixin_45121946/article/details/104727562