Reputation: 13923
* d556e92 // added 789 in new line inside file1.txt (HEAD -> master)
* 79fe73c // added 456 in new line inside file1.txt
* 574a673 // added 123 to file1.txt
* c50371c // created file1.txt with no content
file1.txt in
master` branch:
123
456
789
When I run git diff 574a673..79fe73c
I expect to see only: +456
. But the output is different:
$ git diff 574a673..79fe73c
diff --git a/file1.txt b/file1.txt
index d800886..156626c 100644
--- a/file1.txt
+++ b/file1.txt
@@ -1 +1,2 @@
-123
\ No newline at end of file
+123
+456
\ No newline at end of file
My question:
Does git tell me that I removed "123" and added "123" in the same commit: 79fe73c
?
Upvotes: 1
Views: 52
Reputation: 12233
You removed
123
and replaced it with
123\n
New line starts after line termination symbol, so adding new line actually modifies the one before, because \n
is appended to it.
Upvotes: 2