Discuss / Git / 关于git rm <filename>的问题

关于git rm <filename>的问题

Topic source

想问下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)


想让分区的也删除,需要commit一下。要恢复,可以用git reset --hard HEAD

  • 1