1

I am facing a similar example as in this tutorial: https://www.atlassian.com/git/tutorials/saving-changes/git-diff

Executing git diff:

git diff commit1 commit2

I get the following output:

diff --git a/diff_test.txt b/diff_test.txt
index 6b0c6cf..b37e70a 100644
--- a/diff_test.txt
+++ b/diff_test.txt
@@ -1 +1 @@
-this is a git diff test example
+this is a diff example

How do I know which commit is a and which is b?

jub0bs
  • 60,866
  • 25
  • 183
  • 186
JSBach
  • 4,679
  • 8
  • 51
  • 98
  • `a/` and `b/` are know as the source and destination prefixes, respectively. They're just markers associated to (in your specific case) `commit1` and `commit2`, respectively. – jub0bs Sep 27 '18 at 19:29
  • Related: https://stackoverflow.com/q/6764953/2541573 – jub0bs Sep 27 '18 at 19:32
  • I agree, but who is a and who is b, and why? – JSBach Sep 27 '18 at 19:32
  • In your case, `a/` corresponds to `commit1` and `b/` corresponds to `commit2`. – jub0bs Sep 27 '18 at 19:33
  • Ok, can you please change your comment to an answer, so I can mark it as answer? commit1 is a, but because it is marked with "-" signs, it confused me and I interpreted the change on the other way arround. When using diff to compare two commits, it seems that it is better to use diff olderCommit newerCommit – JSBach Sep 27 '18 at 19:36
  • Check out the question I link to. Could we not close yours as a duplicate of it? – jub0bs Sep 27 '18 at 19:37
  • 1
    If you prefer.. :) I voted to close – JSBach Sep 27 '18 at 19:39

0 Answers0