同时显示舞台和舞台工作树在git diff? [英] Show both staged & working tree in git diff?
问题描述
如果我运行 git diff
,我会看到工作树中的更改,如果我运行 git diff --staged
(或者 --cached
),然后我看到正在执行的更改(w / git add
),但是有一种方法用 git diff
来一次查看所有内容吗?
有没有办法用git diff来一次查看所有内容?
有,使用Git 2.4.0+(2015年4月)。
a href =https://github.com/git/git/commit/40555000935147f56896e75b919b25f1f2d23aca =noreferrer> commit 4055500 from Michael J Gruber mjg
:
commit
/status
:用-v -v $ c $显示index-worktree diff c>(或
-vv
)
git commit
和长格式的git status
显示HEAD
和给定-v
时的索引之间的差异。这允许预览一个提交。
它们还列出了跟踪的文件,其中包含未分离的更改,但没有差异。
介绍'
-v -v
'(或-vv
),它显示索引与
worktree 另外添加到HEAD
索引差异。这允许查看可能从提交中丢失的未分离更改。
在<
-v -v '(或 -vv
),额外的标题行
更改承诺:
和
没有为commit提交的更改:
被插入到diffs之前,等于状态部分的值;后者前面加上50 *
-
以使它更加突出。
在OP的情况下,一个简单的 git status -v -v
(或者 git status -vv
)会同时显示两个阶段的和非分离差异。
If I run git diff
I see the changes in my working tree, and if I run git diff --staged
(alternatively --cached
) then I see the changes that are staged (w/ git add
) but is there a way with git diff
to see all in one go?
Is there a way with git diff to see all in one go?
There is, with Git 2.4.0+ (April 2015).
See commit 4055500 from Michael J Gruber mjg
:
commit
/status
: show the index-worktree diff with-v -v
(or-vv
)
git commit
andgit status
in long format show the diff between HEAD and the index when given-v
. This allows previewing a commit to be made.They also list tracked files with unstaged changes, but without a diff.
Introduce '
-v -v
' (or-vv
) which shows the diff between the index and the worktree in addition to theHEAD
index diff. This allows a review of unstaged changes which might be missing from the commit.In the case of '
-v -v
' (or-vv
), additional header linesChanges to be committed:
and
Changes not staged for commit:
are inserted before the diffs, which are equal to those in the status part; the latter preceded by 50*
-
to make it stick out more.
In the OP's case, a simple git status -v -v
(or git status -vv
) will show both staged and unstaged diffs.
这篇关于同时显示舞台和舞台工作树在git diff?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!