想问下git rm <filename>的条件是工作区、暂存区、分支三处的文件内容一致吗?
当我这三处内容不一致时,显示error: the following file has staged content different from both the file and the HEAD: readme.txt (use -f to force removal)
和error: the following file has local modifications: readme.txt (use --cached to keep the file, or -f to force removal)
不是,是将暂存区和工作区的file一并删除。
想让分区的也删除,需要commit一下。要恢复,可以用git reset --hard HEAD
Sign in to make a reply
用户6476641607
想问下git rm <filename>的条件是工作区、暂存区、分支三处的文件内容一致吗?
当我这三处内容不一致时,显示error: the following file has staged content different from both the file and the HEAD: readme.txt (use -f to force removal)
和error: the following file has local modifications: readme.txt (use --cached to keep the file, or -f to force removal)