[Git]解决:error: The following untracked working tree files would be removed by checkout:
1 文由
不小心在本地对master分支做了修改,并commit了,但是没有push成功(因为处于防止代码提交风险,产品部对普通开发者没有项目master的push权限)
后来又经过了一顿骚操作(我已经不知道干了啥了....做了很多错误操作,like: git reset --hard ... / ...)
结果就是,本地的代码已经废了。。。
but,gitlab远程仓库上的代码是一干二净的,就是本地的代码废了。
此时,我重新从gitlab的dev分支拉了一份代码,但是当git checkout master分支时,却报了如下错误:
error: The following untracked working tree files would be removed by checkout:

2 解决方法
$ git clean -d -fx
Removing .gitignore
Removing README.md
Removing pom.xml
Removing src/
[此时,问题已解决了]
$ git pull
$ git checkout master
$ git checkout dev
-n -----显示将要删除的文件和目录;
-x -----删除忽略文件已经对git来说不识别的文件
-d -----删除未被添加到git的路径中的文件
-f -----强制运行
X 参考文献
[Git]解决:error: The following untracked working tree files would be removed by checkout:的更多相关文章
- git解决error: The following untracked working tree files would be overwritten by checkout
在IDEA中进行分支切换时,出现如此错误,导致无法正常切换:error: The following untracked working tree files would be overwritten ...
- git checkout 提示 “error: The following untracked working tree files would be overwritten by checkout” 解决
问题描述 Windows 或者 macOS 操作系统中,文件名是不区分大小写的.对于已经提交到仓库中的文件修改文件名的大小写,然后又用 git rm 命令将老文件从 Git 仓库删除掉,并保存下新的文 ...
- Git错误:error: The following untracked working tree files would be overwritten by merge:
[andy@localhost weixin_robot]$ git pull Updating d652d1c..fa05549 error: The following untracked wor ...
- Error pulling origin: error: The following untracked working tree files would be overwritten by...
git在pull时,出现这样的错误的时候,可能非常多人进进行stash.相关stash的请看:Error pulling origin: error: Your local changes to th ...
- 错误 error: The following untracked working tree files would be overwritten by merge:README.md
问题类型 相信很多小伙伴在创建新的git仓库后,会选上添加README.md文件,开始我也没太在意,应该也没有什么问题. 但是当我通过git添加远程仓库,给这个仓库上传代码时,出现了如下问题:erro ...
- Some untracked working tree files would be overwritten by checkout. Please move or remove them before you can checkout. View them
Some untracked working tree files would be overwritten by checkout. Please move or remove them befor ...
- git clean解决 GIT error: The following untracked working tree files would be overwritten
git clean用法:https://www.cnblogs.com/lsgxeva/p/8540476.html :
- git更新代码报错,error: The following untracked working tree files would be overwritten by ch
git忽略大小写导致的, git config --add core.ignorecase true
- git pull 错误:The following untracked working tree files would be overwritten by merge
错误描述: $ git pull origin alphaFrom https://github.com/shirley-wu/HeartTrace * branch alpha ...
- The following untracked working tree files would be overwritten by merge
git pull的时候遇到这样的问题: The following untracked working tree files would be overwritten by merge balabal ...
随机推荐
- elementUI el-tree报错 Cannot read property ‘setCheckedKeys’ of undefined"
给树节点赋值时,执行下面代码会报错,原因是:DOM元素未加载完成. 以下为错误写法. handleRowClick(row) { this.$refs.tree.setCheckedKeys(ids) ...
- 攻防(一)tomcat CVE-2020-1938 ftp 21端口
TOMCAT kali自带POE msf6 > use auxiliary/admin/http/tomcat_ghostcat set RHOST 10.98.xx.xx msf6 auxil ...
- mybatis中xml配置文件头部
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE configuration PUBLIC ...
- opened by another process write access was denied sourceinsight
Ubuntu 16.04 安装Samba 和 windows 安装Source Insight weixin_43764544 2021-01-07 15:23:03 23 收藏 文章标签: linu ...
- Linux系统管理实战-软件包管理
软件包管理 在Linux中,不同的发行版软件管理的方式可能不一样,具体来说,主要分为两大派: RPM: Rpm Package Manager CentOS系统软件安装三种方式 rpm:安装简单,可定 ...
- api接口基础Day2
精华笔记: 正则表达式: 用于描述字符串的内容格式,使用它通常用于匹配一个字符串是否符合格式要求 正则表达式的语法:-------------了解.不用纠结.不用深入研究 1.[]:表示一个字符,该字 ...
- Jenkins集成appium自动化测试
一,引入问题 自动化测试脚本绝大部分用于回归测试,这就需要制定执行策略,如每天.代码更新后.项目上线前定时执行,才能达到最好的效果,这时就需要进行Jenkins集成. 不像web UI自动化测试可以使 ...
- java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:解决办法
激动的心,颤抖的手.本来web项目数据库连接的好好地,突然就连不上了,一直报java.sql.SQLException: No suitable driver found for jdbc:mysql ...
- awk command
https://www.cnblogs.com/bluevitality/p/6691041.html
- 2021.01.08 oss is not defined
背景: 视频点播使用阿里云的oss(Object storage services),然后总是报错oss is not defined, 在网上搜索了一些文章,基本上都是一模一样的,我也就不吐槽啦(这 ...