git:为什么git diff不显示任何差异?(git: Why doesn't git diff show any differences?)
如果我在repo上运行'git status',它会提供:
# On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: myfile但是,如果我执行'git diff myfile',则不会显示任何差异。 这是因为我做了一个改变,并将其删除,以便它回到原始状态?
我应该运行'git checkout myfile'来清除它吗?
If I run 'git status' on my repo it gives:
# On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: myfileHowever, if I do a 'git diff myfile' it shows no differences. Is this because I have made a change and removed it so it is back to the original?
Should I run 'git checkout myfile' to clear it?
最满意答案
您的文件已经上演提交。 你可以使用git的--cached选项来显示它的差异。
git diff --cached myfile要取消它,只要做它的输出git状态建议;)
你可以查看Git索引了解更多信息。
Your file is already staged to be committed. You can show it's diff using the --cached option of git.
git diff --cached myfileTo unstage it, just do what git status suggests in it's output ;)
You can check The Git Index For more info.
更多推荐
发布评论