我无法摆脱我的仓库似乎被锁定的状态。在重置到 HEAD~1 后,我不断收到有关此单个文件被修改的通知。'add' 和 'checkout' 没有影响。我有 core.autocrlf 和 core.safecrlf 未设置(空)。
请看下面:
$ git --version
git version 1.7.9.6 (Apple Git-31.1)
$ git status
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: a_file_name.cpp
以下命令(单独运行)没有影响:
$ git checkout -- a_file_name.cpp
$ git reset a_file_name.cpp
$ git add a_file_name.cpp
$ git reset --hard
$ git clean -n
<nothing>
$ git clean -f
<nothing>
$ git status
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: a_file_name.cpp
它继续......
我做错什么了?
对下面@Don 的建议的回应(git rm),没有变化,但它是这样的:
$ git rm
error: 'a_file_name.cpp' has local modifications
(use --cached to keep the file, or -f to force removal)
$ git rm -f a_file_name.cpp
rm 'a_file_name.cpp'
$ git status
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# deleted: a_file_name.cpp
#
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: a_file_name.cpp
#
$ git commit -m"tmp"
[master 2a9e054] tmp
1 file changed, 174 deletions(-)
delete mode 100644 a_file_name.cpp
$ git status
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: a_file_name.cpp
#
几乎回到 sq.1