在 git 中看到仅提交文件的一部分的预期结果?

Seeing the expected results of a commiting only part of a file in git?

所以假设我已经 运行 git add -p 并且我已经选择了我想添加到文件中的帅哥,以及我不想添加到文件中的帅哥文件。如何在不提交的情况下根据即将提交的内容查看完整的结果文件?

我尝试使用上面链接的 git diff --staged,但它只显示了为提交准备的更改,而不是将提交到我的本地存储库的完整结果文件。或者我不应该担心这个,无论如何提交然后 undo the last commit?

您应该能够看到当前缓存(暂存)的文件:

git show :file

git show uses gitrevisions

:path (with an empty part before the colon) is a special case of the syntax: content recorded in the index at the given path.