当前位置:   article > 正文

git error: The following untracked working tree files would be overwritten by checkout:_git.exe checkout master -- error: the following un

git.exe checkout master -- error: the following untracked working tree files

当我切换分支时报错:

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

...

问题原因

 当前分支下这些未追踪的文件,在我即将切换来的新分支里已经被追踪了,导致git不确定如何处理这些文件。

处理方法

要么告诉git直接覆盖这些文件

git checkout -f target-branch

要么将这些文件追踪起来,然后git stash保存它们,然后也就可以切换了

git add file file

git stash

git checkout target-branch

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/407443
推荐阅读
相关标签
  

闽ICP备14008679号