GIT bash没有通过“git diff”识别对“.classpath”文件的更改

时间:2017-02-14 17:15:18

标签: windows git git-bash git-diff

我使用命令行GIT GNU bash作为GIT客户端,检查我在Eclipse中工作的Java项目。

作为工作的一部分,我更改了一些项目构建设置,它们在Eclipse中记录在项目根目录中名为“.classpath”的隐藏(.dot)文件中。

出于某种原因,git diff拒绝承认此更改:

user@HOST MINGW64 /c/_GIT/myserver (BRANCH1)
$ git diff .classpath

<==== crickets. Empty output!!!!

但是,我可以看到文件已更改,带有最近的时间戳(并且可以通过显式执行git commit并推送更改来证明它已更改):

user@HOST MINGW64 /c/_GIT/myserver (BRANCH1)
$ git commit -m "remove test" .classpath

[BRANCH1 bd4c1c5] remove test
 1 file changed, 28 insertions(+)
 create mode 100644 .classpath

user@HOST MINGW64 /c/_GIT/myserver (BRANCH1)
$ git push
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 610 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Simple Bitbucket Commit Checker
remote: Create pull request for BRANCH1:
remote:   http://GIT_URL....
remote:
To http://GIT_URL....
   77981fe..bd4c1c5  BRANCH1 -> BRANCH1

GNU bash,版本4.3.46(2)-release(x86_64-pc-msys)

1 个答案:

答案 0 :(得分:1)

没有任何选项或参数的

git diff显示工作树和索引之间的变化。很可能你的更改是为了提交而进行的(通过git add)。您可以运行git status来验证。要查看此类更改(即索引与HEAD之间的差异),您应该运行git diff --staged