当前位置: 动力学知识库 > 问答 > 编程问答 >

git - diff staged and unstaged files in diff

问题描述:

Let's say I have file

1

2

3

4

5

and I changed it like this

1

222

3

444

5

now I applied patch with git add -p and added only the first change (2 -> 222)

What I can do to view unstaged changes againts staged to see output like this:

@@ -1,6 +1,6 @@

- 4

+ 444

网友答案:

You can run git diff. Git diff compares your index against your stage, not your head. Your already added changes (222) will not be displayed because they are already in your stage, so you will see the changed 444 line only.

分享给朋友:
您可能感兴趣的文章:
随机阅读: