Zbigniew Kisły
Zbigniew Kisły

Reputation: 742

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

Upvotes: 0

Views: 4142

Answers (1)

Nicky McCurdy
Nicky McCurdy

Reputation: 19573

You can run `git diff, which 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.

Upvotes: 5

Related Questions