git - 在 git 中撤消修改的文件不起作用

标签 git

我已经修改了我的 git 仓库中的文件,但是 git checkout <file>不起作用,git reset --hard 也不起作用.没有任何错误消息。我也有一个 *.orig 和 git clean -f也不删除那个文件?

最佳答案

如果 git checkoutgit reset --hard 使文件处于修改状态,这可能是由 git 修改行尾或空格引起的。

运行 git diff --ignore-space-change 查看是否有非空白更改。

如果*.orig文件没有被git跟踪,但是被忽略,你必须添加-x参数,这样git就不会使用标准的ignore规则。

git clean -f -x

关于git - 在 git 中撤消修改的文件不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18098538/

相关文章:

git - 在 merge 到 master 之前我如何在其他分支上工作?

Git - 查找 repo 中的哪些应用程序已更改

html - Github页面404找不到文件

django - 如何在 Django 应用程序的 CI 中处理迁移

git - VS 2017 pull 操作失败

php - 允许 Apache 执行 git pull

Git 错误 : "Please make sure you have the correct access rights and the repository exists"

git - 如何推送到非裸 Git 存储库?

git - 致命的 : Not a Git Repository

git - 将 git 用于具有很多很多 repos 的项目