XY problem:
I ran git show <filepath> to see the current version of a file. But I'm a bit confused by the output:
commit <abc1234...> (HEAD -> <branch>)
Author: <Fname Lname> <fname.lname@email.com>
Date: <Date>
<Commit message>
diff --git a/<filepath> b/<filepath>
index bcd4567..dedbeef 100644
--- a/<filepath>
+++ b/<filepath>
It's telling me that git show is showing me a diff of something, between bcd4567 and dedbeef. I want to know what these hashes are referring to. I know that I can use git cat-file -t <hash> to see the type of object these hashes are referring to (they're blobs) and I can use git cat-file -p <hash> to see the object themselves. So I know what file they are referring to. What I don't know is which version of the file they're referring to.
So there are two questions here. The direct question is:
- What does the line
index bcd4567..dedbeef 100644refer to in thegit showoutput? What versions of a file is it showing me? Is it showing the difference between the work tree and the index, or something else?
And more generally:
- Given a situation where I have an unknown hash and want to know where it comes from, how can I discover this? Is there a command that will allow me to find e.g. all tree objects which point to a given hash, or to discover all the names (branch, tag, etc.) that a hash has been given?