git diff认为没有变化..即使git status报告他们被修改了?
$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
new file: file-added
modified: file-with-changes << it knows there are changes
Run Code Online (Sandbox Code Playgroud)
但为了看到差异,我需要显式添加最后一个reversion哈希..
$ git diff
(nothing)
$ git diff rev-hash
diff --git a/file-with-changes b/file-with-changes
index d251979..a5fff1c 100644
--- a/file-with-changes
+++ b/file-with-changes
.
..
Run Code Online (Sandbox Code Playgroud) 有没有可能开始跟踪git中的文件而不将它们添加到索引?
我有新的文件,我想生存下来git clean,但可能会在下次提交之前更改.我现在只是将它们添加到索引中,然后在提交之前再次添加它们吗?