'Is there a built-in way to use a git hash based on its .git/objects path?
I'm interested in playing around with git cat-file in order to better understand Git's object model. One thing that's a bit of a nuisance in the Git Bash shell is copying a hash (especially as I'm not used to Git Bash's C&P shortcuts.)
Let's say I have a hash abc123... etc., stored like this:
ls .git/objects/ab/c123abc123abc123abc123abc123abc123abcd
I can use sed and such to extract the hash portion of the path:
ls .git/objects/ab/c123abc123abc123abc123abc123abc123abcd | sed -e 's|.git/objects/||' -e 's|/||'
But I still need to navigate to the hash and paste the sed command in and so on. It's not a major annoyance but for the time it takes me to do I might as well copy the hash manually.
The question: is there a Git built-in function which reads the path to the hash in .git/objects and outputs a useable hash? I.e.
Input:
.git/objects/ab/c123abc123abc123abc123abc123abc123abcd
Output:
abc123abc123abc123abc123abc123abc123abcd
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
