git - Git 无法切换分支、存储或结帐
问题描述
我尝试将分支从 master 切换到 dev
git checkout dev
error: Your local changes to the following files would be overwritten by
checkout:
vendor/symfony/console/Resources/bin/hiddeninput.exe
Please, commit your changes or stash them before you can switch
branches.
Aborting
我尝试删除更改
git checkout vendor/symfony/console/Resources/bin/hiddeninput.exe
git checkout dev
error: Your local changes to the following files would be overwritten by checkout:
vendor/symfony/console/Resources/bin/hiddeninput.exe
Please, commit your changes or stash them before you can switch branches.
Aborting
我试着藏起来
git stash
error: Your local changes to the following files would be overwritten by checkout:
vendor/symfony/console/Resources/bin/hiddeninput.exe
Please, commit your changes or stash them before you can switch branches.
Aborting
我试着忽略它
git update-index --assume-unchanged vendor/symfony/console/Resources/bin/hiddeninput.exe
git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
git checkout dev
error: Your local changes to the following files would be overwritten by checkout:
vendor/symfony/console/Resources/bin/hiddeninput.exe
Please, commit your changes or stash them before you can switch branches.
Aborting
有什么建议么?
解决方案
不久前我遇到了类似的问题。事实证明文件的行尾自动更改(由文件中的混合行尾引起)。这可以使用 -
git config core.autocrlf
为了解决这个问题,请将 core.autocrlf 设置为 false。
git config --global core.autocrlf false
在此之后尝试执行 git checkout your-filename 。希望这可以帮助。
推荐阅读
- fortran - 编译后的英特尔编译器 XE 19 在 Windows 10 AMD Ryzen 上无法使用 /Qparallel 出现错误 0xc000007b
- deployment - 可以将非 web .net 核心控制台应用程序部署到 Azure 应用程序服务吗
- javascript - 如果条件为真或假,角度数组内容会发生变化?意外行为
- android - 使用 AsyncTask 从 Room 中返回自动生成的 id,使用 MVVM 返回 onPostExecute
- python - 在 mongodb insert 上执行 python 脚本
- python - FormView 不更新但创建新的模型记录
- c# - 让 200 个客户端一次连接到服务器
- node.js - 如何从请求模块响应中存储cookie客户端
- c# - 在 C# 中指定用于任务的线程
- security - 扫描本地项目的安全标头