【Git】error: The following untracked working tree files would be overwritten by checkout

这篇具有很好参考价值的文章主要介绍了【Git】error: The following untracked working tree files would be overwritten by checkout。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

现象描述

(注意数据备份)
一个项目由submodule 方式组成了一个主仓库,当在主仓库中修改了多个submodule 的version,同时也修改了一些非submodule 的文件内容。在git add ,git commit ,git push 都成功后,想切换到某个branch(A) 的时候,报出错误error: The following untracked working tree files would be overwritten by checkout。但是 git status发现也没有修改项。
后来发现,可以切换到另一些branch。

error: the following untracked working tree files would be overwritten by ch,GIT,githuberror: the following untracked working tree files would be overwritten by ch,GIT,github

解决过程

1.新建一个本地repo(A),从之前push成功的远端repo pull 下来,与报错The following untracked working tree files would be overwritten by checkout 的仓库(B)进行对比,发现内容一致,说明本地内容的确成功上传到了远端。
2.尝试使用git --cached git clean -d -fx
-x means ignored files are also removed as well as files unknown to git.
-d means remove untracked directories in addition to untracked files.
-f is required to force it to run.
没有任何效果
3.后发现为修改文件的时候大小写被修改,使用命令

git config core.ignorecase true 后成功解决该问题。

error: the following untracked working tree files would be overwritten by ch,GIT,github文章来源地址https://www.toymoban.com/news/detail-523389.html

到了这里,关于【Git】error: The following untracked working tree files would be overwritten by checkout的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • git pull报错:error: Your local changes to the following files would be overwritten by merge:

    合作项目,之前用笔记本把代码做了一些修改、提交,修改完成。第二天忘了先 git pull 到本地,直接进行编写,突然想起忘了 pull 了,然后想用 git pull 来更新本地代码,结果报错: error: Your local changes to the following files would be overwritten by merge: 意思是我本地上新修改的代码的

    2024年02月04日
    浏览(46)
  • git pull 时提示 error: Your local changes to the following files would be overwritten by merge

    这个错误提示说明你本地有未提交的修改,但是你又尝试从远程仓库拉取更新,导致合并时出现冲突。你需要先解决冲突,再进行拉取更新操作。 有几种解决方法: 1、提交本地修改:如果你对本地修改进行了保存并且希望保留这些修改,可以先提交修改,然后再拉取更新。

    2024年02月07日
    浏览(42)
  • error: Your local changes to the following files would be overwritten by merge:(有未提交的文件 git pull冲突解)

    这个错误通常发生在你尝试将远程分支合并到本地分支时,但你的本地分支上存在未提交的更改。Git会阻止合并操作,以防止你的未提交更改被覆盖。 解决这个问题的方法有两种: 1.提交或撤销本地更改:如果你的本地更改不再需要,可以使用以下命令撤销或丢弃这些更改:

    2024年02月20日
    浏览(10)
  • error: Your local changes to the following files would be overwritten by checkout:

    error: Your local changes to the following files would be overwritten by checkout:

    无意间从同事那里听到stash这个命令。于是想到之前遇到的切换分支时遇到的文件状态的问题,所以花了点时间整理了以下笔记,来加深对此命令的认识。 有时,当你在项目的一部分上已经工作一段时间后,所有东西都进入了混乱的状态, 而这时你想要切换到另一个分支做一

    2023年04月08日
    浏览(9)
  • git报错-Your local changes to the following files would be overwritten by merge:

    有一天我在服务器拉取git仓库的代码时报错如下   大概意思就是试图合并一个分支到你的当前分支,但是在你的当前分支上,有三个 .pyc 文件有本地未提交的修改。这些修改如果进行合并操作,将会被合并过来的分支中的对应文件内容覆盖。 错误信息建议在合并之前,你需

    2024年04月10日
    浏览(16)
  • Git常见报错:Your local changes to the following files would be overwritten by merge

    Git常见报错:Your local changes to the following files would be overwritten by merge

    1、报错原因 该报错在git pull时出现,一句话解释就是你在本地改动了代码但是还没有提交,此时再拉取最新代码,远程代码和你当前的本地代码发生冲突!(注意有冲突时才会提示,如果没有冲突,则git pull成功,因为git pull实质上就是一个远程分支merge到本地分支过程。 2、解

    2024年02月08日
    浏览(9)
  • IDEA GIt切换分支报错:Your local changes to the following files would be overwritten by Checkout.

    IDEA GIt切换分支报错:Your local changes to the following files would be overwritten by Checkout.

    一、前言 在我们本地有未commit的文件时,使用IDEA切换分支的时候会报如图所示错误: 意思就是对当前分支文件的更改会被Checkout覆盖。可以搁置更改然后签出和取消搁置。 二、解决办法 方案1、将文件commit 方案二、stash方式 三、Git命令 Terminal输入命令如下 推荐使用第二种方

    2024年02月02日
    浏览(15)
  • Your local changes to the following files would be overwritten by checkout

    Your local changes to the following files would be overwritten by checkout

    Git 之 Your local changes to the following files would be overwritten by checkout 今天在切换分支时遇到了这样一个问题: 首先翻译下: Your local changes to the following files would be overwritten by checkout 大致意思就是: 当前分支有未跟踪的文件,checkout会覆盖他们,IntelliJ IDEA 会搁置改变,在那之后

    2024年02月14日
    浏览(45)
  • git 请求合并代码报错(The form contains the following error: Validate branches Another open merge request al)

    自己的远程仓库,已经有最新的代码了,但是提pr,就是提不了 在本地,删除远程分支,然后重新提交代码就行了

    2024年02月03日
    浏览(21)
  • git | 如何移除 Untracked files?

    git | 如何移除 Untracked files?

    日常开发中有时会遇到 untracked files: 即使执行 git checkout . ,或者执行 git stash ,它们依旧存在。虽然可以手动把它们删掉,不过文件多的时候会很繁琐。 方案一: 这个时候可以使用 git clean -f ,不过要记住使用之前先使用 git clean -n 查看一下将被删除的文件是哪些,避免误

    2024年02月12日
    浏览(8)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包