Having an initial repository I create a Test.TXT file and fill it in with this content:
Version 1
Version 1
Version 1
Next, it is committed:
$ git commit -am Version1
And the Test.TXT has suffered some ammendment:
Version 1
Version 2
Version 1
$ git commit -am Version2
Now I'm curious to find out what changes were made to the file since Version1:
$ git log --oneline -- Test.TXT
f315c22 (HEAD -> master) Version2
3b173c2 Version1
$ git blame 3b173c2 .. -- Test.TXT
^3b173c2 (Mergasov 2020-10-06 13:49:50 +0300 1) version 1
^3b173c2 (Mergasov 2020-10-06 13:49:50 +0300 2) version 1
^3b173c2 (Mergasov 2020-10-06 13:49:50 +0300 3) version 1
Such blame's output is a bit unexpected for me.
Firtsly, what does the caret symbol (^) stand for here? The blame docs refer to it as a boundary marker (that is, it marks the first commit for a file). But if I type in the HEAD (it's the second commit of the Test.TXT) instead of 3b173c2, I would get ^f315c22 (in every rows) yet again.
So using git blame in this way just cause appearence of the version of a file which fits the choosed SHA1 commit, doesn't it? It doesn't even show SHA1 of either previous commits (such result can be achieved by using blame without two dots) nor following ones (it that I try to accomplish). In lieu we can see the typed SHA1 version setting off by the caret symbol.
Can anyone explain what's the reason to use this command (with the double dot)?
If you were to simply execute the command (in the repo root):
git would tell you:
The argument:
in this case, is a reference to the parent directory. If you then pass a file as argument:
You'll notice that the output has the
^abcdbeefsyntax for each line as well as your name as the committer (while it may in fact have been someone elses file). The^before a reference means its not reachable from your current branch/reference.