使用difftool在同一文件的分阶段和非分阶段版本之间的差异

DrK*_*liN 11 git diff git-diff difftool git-stage

有没有办法查看同一文件的版本stagedunstaged版本之间的差异?

例如:

Changes to be committed:

    modified:   conf/application.conf

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   conf/application.conf
Run Code Online (Sandbox Code Playgroud)

当我进行更改然后再次修改文件而不进行暂存时会发生这种情况.

EDIT

git status -vv命令还不够好,因为我需要使用diff/ difftool命令.这是因为在实践中,太多文件中的更改太多,滚动浏览所有文件并不高效.但diff/ difftool允许我指定我感兴趣的文件.

Ran*_*ght 28

git diff 将显示工作区和索引之间的差异.(索引是暂存文件的位置)

这似乎并不明显,因为我们通常git diff用来查看工作区中的更改与签入的内容.但是,技术上git diff显示工作区与索引,如果您尚未向索引添加更改,则索引与您签出的内容相匹配.

  • 查看工作区vs repo: git diff HEAD
  • 看索引vs repos :( git diff --cached也可以使用--staged)
  • 查看工作区与索引: git diff