git本地与远程冲突

写项目的时候git pull提示这样的错误

error: Your local changes to the following files would be overwritten by merge:
        web/src/components/exam/examInforLeft.vue
Please commit your changes or stash them before you merge.
Aborting
Updating 16171b9..6a02b55

错误出现原因大致是:本地修改了a文件,远程同事上传了修改好的a文件而导致的错误

解决办法是:

1.git pull 然后报错(提示冲突)
2.git add --all git commit -m '注释' (先把本地文件提交上去)
3.再次git pull (这样远程文件拉取到本地,并修改冲突的文件)
4.git add . git commit -m '注释'(修改后的文件提交)
5.git push 推到远程库

posted @ 2022-09-29 14:58  与君别  阅读(110)  评论(0编辑  收藏  举报