我对 git 有奇怪的问题。我的 .gitignore 文件似乎被跟踪了,但我无法提交。
命令行:
user@STATION ~/repository (my_first_branch)
$ git checkout my_second_branch
error: Your local changes to the following files would be overwritten by checkout:
.gitignore
Please, commit your changes or stash them before you can switch branches.
Aborting
user@STATION ~/repository (my_first_branch)
$ git add .gitignore
user@STATION ~/repository (my_first_branch)
$ git commit
# On branch my_first_branch
nothing to commit, working directory clean
user@STATION ~/repository (my_first_branch)
$
所以我不能签出其他分支,因为 .gitignore 我对此无能为力。
我找到的唯一解决方案是手动删除.gitignore,但我想跟踪它。文件 .gitignore 不在我的 .gitignored 中,我不知道为什么不跟踪它。
我无法提交或隐藏它。
更新:混帐状态:
user@STATION ~/repository (my_first_branch)
$ git status
# On branch my_first_branch
nothing to commit, working directory clean