可能是重复问题:
如何查看已暂存的更改?
有没有一种简单的方法可以查看在git中仅限于已暂存更改的差异?我已经暂存了几个文件,但在提交之前想再仔细看一下要提交的内容。我还有其他几个未暂存的更改需要单独提交,因此取消暂存,执行git diff,然后浏览到我想要的文件并不是一个理想的选项。
示例:
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: foo.java
#
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: bar.java
# modified: baz.java
# modified: qux.java
我只想查看foo.java
中的更改,而无需取消暂存。
git status -v -v
查看已暂存和未暂存的更改:请参见 https://dev59.com/hWcs5IYBdhLWcg3wMhCz#29116346。 - VonC