Is there any limitation for n in git show HEAD^n
or git show HEAD~n
commands? when I run git show HEAD^4
it gives me fatal: ambiguous argument 'HEAD^4': unknown revision or path not in the working tree.
error while running git show HEAD^^^^
shows me the corresponding commit.
Asked
Active
Viewed 15 times
0

amiref
- 3,181
- 7
- 38
- 62
-
1`HEAD^^^^` is equivalent to `HEAD~4`, not `HEAD^4`. – mkrieger1 Oct 09 '20 at 13:09
-
in HEAD^n , n cannot be greater than 2 and HEAD^2 is only the case when the HEAD is pointing to a result of a merge – amiref Oct 09 '20 at 13:35
-
1n can also be greater than 2 in HEAD^n, if a commit has more than 2 parents. – mkrieger1 Oct 09 '20 at 13:39
-
1@amiref a commit can have more than two parents, so n can be greater than 2. It’s not common though. – evolutionxbox Oct 09 '20 at 13:51