gpt4 book ai didi

git - 似乎无法放弃 Git 中的更改

转载 作者:IT王子 更新时间:2023-10-29 01:22:17 25 4
gpt4 key购买 nike

从命令行看到以下内容后:

# On branch RB_3.0.10
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: index.htm

我试图通过键入以下命令放弃我的更改:

git checkout -- index.htm

但是当我重新运行 git status 时,它看起来完全一样。 checkout 似乎不起作用。难道我做错了什么?我在 windows/cygwin 上使用 GIT 1.6.1.2。

# On branch RB_3.0.10
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: index.htm

最佳答案

这已经困扰了我一段时间,几乎我检查的每个 repo 协议(protocol)都有我无法丢弃的更改。长话短说,我尝试了以上所有方法,但没有任何效果。这是我为使事情恢复正常所做的(在 Mac 上):

Completely remove the autocrlf & safecrlf settings from ~/.gitconfig
Completely remove the autocrlf & safecrlf settings from your repo's local config ./.git/config
git rm --cached -r .
git reset --hard

关于git - 似乎无法放弃 Git 中的更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1575682/

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