gpt4 book ai didi

git - 无法 checkout 到其他分支,因为忽略的文件有本地更改?

转载 作者:太空狗 更新时间:2023-10-29 13:11:03 24 4
gpt4 key购买 nike

我得到:

$ git checkout mybranch
error: Your local changes to the following files would be overwritten by checkout:
.idea/workspace.xml
Please, commit your changes or stash them before you can switch branches.
Aborting

但是.idea/已经在我的.gitignore中了。如果我执行 git status,也不会显示任何更改。

请指教。

更新:

感谢您的建议。我希望我可以去 mybranch 并检查,但我不能,因为它不允许我切换!如果忽略 .idea/ 是正确的行为(它们是来自 IDE 的项目配置文件),我现在应该做什么?我的目标是转到 mybranch 并将其与 master merge 。您可以将 mybranch 视为生产分支,将 master 视为开发分支。现在我想更新 prod,因为 master 已经足够稳定了。

最佳答案

就我而言,这是由于我的前任

git update-index --assume-unchanged <filename>

那个文件有冲突。通过

撤销这种情况
git update-index --no-assume-unchanged <filename>

并提交由此产生的新状态,一切都已解决。

更新:修正参数中的拼写错误。

关于git - 无法 checkout 到其他分支,因为忽略的文件有本地更改?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25118932/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com