idea无法切换分支报错问题及解决
作者:Yuhei001 时间:2023-12-14 22:39:26
idea无法切换分支报错
idea拉取项目后,master分支配置完项目基础配置后,生成.iml等文件不受git管理后无法检出其他分支
报错如下:
Couldn't checkout origin/feature/P2020022059-1030-dev:
The following untracked working tree files would be removed by checkout:
解决办法
删除.iml文件控制,在本地文件目录下打开git控制台执行如下命令
git clean -d -fx
命令解析:
-d -----删除未被添加到git的路径中的文件
-f -----强制运行
-x -----删除忽略文件已经对git来说不识别的文件
idea切换分支异常
error: The following untracked working tree files would be overwritten by checkout
异常文件所在目录情况
左图是正常情况下clone工程后.idea目录和文件名都是黄色;中间是切换分支异常的.idea文件夹名为白色,misc,vcs等是红色,右图是使用命令切换成功后的显示
git使用idea和命令切换分支报错
使用命令
error: The following untracked working tree files would be overwritten by checkout:
.idea/misc.xml
.idea/vcs.xml
Please move or remove them before you switch branches.
使用idea可视化切换
处理方法:删掉这两个文件,用命令切换,结果成功
删掉后,idea右下角会找不到分支的信息,无法用idea自带的切换分支;
此时,使用命令切换:git checkout -b dev/1.3.0 origin/dev/1.3.0
切换后成功显示分支情况,以后可以从这里切换,但是不要再切换会第一次有误的分支(我的是master)
PS:在网上看过其它的文章,是用命令git clean 操作,但是看评论可能导致其它问题
来源:https://blog.csdn.net/Yuhei001/article/details/126381113
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Android 圆角 ImageView类可设置弧度(代码简单)
java判断字符串是否为数字的方法小结
深入C#中使用SqlDbType.Xml类型参数的使用详解
Kotlin基础教程之控制流(顺序,分支,循环)
![](https://img.aspxhome.com/file/2023/5/110755_0s.png)
Netty与NIO超详细讲解
![](https://img.aspxhome.com/file/2023/2/65362_0s.png)
基于Silverlight DataGrid中无代码设置开始与结束日期DatePicker的实现方法
![](https://img.aspxhome.com/file/2023/8/129658_0s.gif)
Spring基于注解的缓存声明深入探究
Java实现多人聊天室(含界面)
![](https://img.aspxhome.com/file/2023/3/92563_0s.jpg)
SpringBoot加密配置文件的SQL账号密码方式
![](https://img.aspxhome.com/file/2023/9/64019_0s.png)
深入谈谈C#9新特性的实际运用
AndroidManifest.xml中含盖的安全问题详解
JAVA线程池原理实例详解
![](https://img.aspxhome.com/file/2023/2/88522_0s.jpg)
C#添加、获取、删除PDF附件实例代码
![](https://img.aspxhome.com/file/2023/1/129751_0s.png)
Eclipse 开发java 出现Failed to create the Java Virtual Machine错误解决办法
IDEA导入外部项目报Error:java: 无效的目标发行版: 11的解决方法
![](https://img.aspxhome.com/file/2023/4/62704_0s.png)
详解Java多线程编程中CountDownLatch阻塞线程的方法
![](https://img.aspxhome.com/file/2023/3/91113_0s.jpg)
vs2019永久配置opencv开发环境的方法步骤
![](https://img.aspxhome.com/file/2023/2/100302_0s.jpg)
Struts2下拉框实例解析
![](https://img.aspxhome.com/file/2023/9/61399_0s.jpg)
Java实现插入排序实例
推荐两款java开发实用工具 hutool 和 lombok
![](https://img.aspxhome.com/file/2023/8/69938_0s.png)