[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 ...
随机推荐
- nuttx理解
操作系统:为啥要引入操作系统,个人的理解是为了实时性(即及时的响应性). 没有操作系统下多个任务都只能以前后台的方式排队执行,对某个任务的输入不能得到及时的响应:虽然后台有中断,但不能把所有的任务都放 ...
- aos.js 与 swiper 组合,翻页后无法触发aos的效果
手动给除第一页之外的需要特效的元素添加 class="aos-animate" 转自:https://cloud.tencent.com/developer/ask/sof/302 ...
- spring-security-oauth2使用遇到的坑
异常信息为 2021-08-22 14:24:11.086 WARN 17812 --- [ main] ConfigServletWebServerApplicationContext : Exce ...
- js中的占位函数
String.prototype.signMix= function() { if(arguments.length === 0) return this; var param = arguments ...
- NOI-1253:Dungeon Master(BFS)
描述You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of ...
- Honeywell安卓版手持机设置广播方式
设置>Honeywell设置>扫描设置>Internal Scanner>Default profile>Data Processing Settings>Data ...
- 3.Vue常用特性
1.表单操作 (1)基于Vue的表单操作 input 单行文本 处理方式就是使用 v-model双向绑定data中的数据 1 <input type="text" v-mod ...
- Java学习笔记(二)环境
卸载JDK 1.删除java的安装目录 2.删除JAVA_HOME 3.删除path下关于java的目录 4.java -version 配置环境变量 1.我的电脑-->右键-->属性 ...
- 【Python】validator进行数据校验
https://pypi.org/project/validator.py/ 校验参数必要性 from validator import Required, In, InstanceOf, Lengt ...
- Mysql 行号+分组行号+取Top记录 SQL
Mysql 行号+分组行号+取Top记录 SQL select * from ( SELECT (@rowNum := @rowNum + 1) as rowNum -- 全量行号 , a.col1 ...