git pull时遇到的问题及解决方法
程序员文章站
2022-06-19 10:57:52
...
[email protected]:learn$ git pull
Updating c626e62..e939e49
error: The following untracked working tree files would be overwritten by merge:
apue/APUE-3rd.pdf
Please move or remove them before you merge.
Aborting
[email protected]:learn$ git status
On branch master
Your branch is behind 'origin/master' by 5 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
Untracked files:
(use "git add <file>..." to include in what will be committed)
.DS_Store
apue/APUE-3rd.pdf
nothing added to commit but untracked files present (use "git add" to track)
解决方法:
在使用Git pull时,经常会遇到报错:
Please move or remove them before you can merge
这是因为本地有修改,与云端别人提交的修改冲突,又没有merge.
如果确定使用云端的代码,最方便的解决方法是删除本地修改,可以使用以下命令:
使用下列命令:
git clean -d -fx ""
d -----删除未被添加到git的路径中的文件
f -----强制运行
x -----删除忽略文件已经对git来说不识别的文件
注意:该命令会删除本地的修改,最好先备份再使用
git clean 参数
-n 显示 将要 删除的 文件 和 目录
-f 删除 文件,-df 删除 文件 和 目录
上一篇: 这些猪肉不算啥
推荐阅读
-
Mysql数据库从5.6.28版本升到8.0.11版本部署项目时遇到的问题及解决方法
-
android开发环境遇到adt无法启动的问题分析及解决方法
-
使用vue-router与v-if实现tab切换遇到的问题及解决方法
-
Hive与Oracle之间利用Sqoop进行数据的导入导出时遇到的问题及解决方法
-
安装Eclipse ADT插件时遇到的问题与解决方法
-
使用 Eclipse 给 APK 签名遇到的问题及解决方法
-
vue项目部署上线遇到的问题及解决方法
-
win7 wamp 64位 php环境开启curl服务遇到的问题及解决方法
-
html5的input的required使用中遇到的问题及解决方法
-
Python中的Socket 与 ScoketServer 通信及遇到问题解决方法