I've read the man page of git-rev-parse, but still have no idea of what does this command do. Let's say I have a git project that has a structure like this:
MyProject
├── Folder1
├── Folder2
├── .git
If I run
git-rev-parse HEAD
then I can get a SHA_1 that is the same as my last commit. Pretty straightforward.
However, if I run
git-rev-parse HEAD: Folder1
then I get another SHA_2 that is different with any SHA that I've ever committed. My question is: what does this "git-rev-parse HEAD: Folder1" mean and what is this SHA_2?
commit:path/to/filedescribes a file (a "BLOB") at a specific commit. For example in the git.git repository:You can find an explanation under the Specifying Revisions section of the
rev-parseman page:Of course,
path/to/filemight be a directory in which case the output hash will point to a tree object instead.