大家好,又见面了,我是你们的朋友全栈君。
1,问题: error: Your local changes to the following files would be overwritten by merge: Please, commit your changes or stash them before you can merge.
解决: (1):如果希望保留生产服务器上所做的改动,仅仅并入新配置项, 处理方法如下:
git stash
git pull
git stash pop
然后可以使用git diff -w +文件名 来确认代码自动合并的情况.
(2):希望用代码库中的文件完全覆盖本地工作版本. 方法如下
git log
git reset --hard
git pull
2,问题: error: The following untracked working tree files would be overwritten by merge: composer.lock Please move or remove them before you merge. Aborting
如果确定使用云端的代码,最方便的解决方法是删除本地修改,可以使用以下命令:
git clean -d -fx ""
d -----删除未被添加到git的路径中的文件
f -----强制运行
x -----删除忽略文件已经对git来说不识别的文件
git clean 参数
-n 显示 将要 删除的 文件 和 目录
-f 删除 文件,-df 删除 文件 和 目录
# 在用上述 git clean 前,墙裂建议加上 -n 参数来先看看会删掉哪些文件,防止重要文件被误删
git clean -nxfd
git clean -nf
git clean -nfd
3,问题 error: Pulling is not possible because you have unmerged files. hint: Fix them up in the work tree, and then use ‘git add/rm ’ hint: as appropriate to mark resolution and make a commit. fatal: Exiting because of an unresolved conflict. 解决
pull会使用git merge导致冲突,需要将冲突的文件resolve掉 git add -u, git commit之后才能成功pull.
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/105922.html原文链接:https://javaforall.cn