我在跟踪文件方面有一个奇怪的问题。我有一个跟踪文件index.css
。然后将其添加到中.gitignore
。然后运行以下命令并获得输出:
$ git rm --cached build/development/css/index.css
rm 'build/development/css/index.css'
运行git status
给出以下内容:
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: build/development/css/index.css
尝试提交更改时,出现以下错误:
Error:On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
during executing git commit --only -F C:\Users\dtv\AppData\Local\Temp\git-commit-msg-7154374096157077481.txt -- build/development/css/index.css
如果我尝试将更改index.css
与后续更改一起提交,则提交将没有错误。但是仍然检测到文件更改。我究竟做错了什么?
问题是的--only
选项git commit
。从git-commit
联机帮助页:
仅从命令行上指定的路径进行提交,而不考虑到目前为止已上演的所有内容。
它尝试提交该文件,而忽略之前的先前git rm --cached
命令。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句