I have a small question: After a "git gc" with last commit being "[shared 
2679648]" I found this:
> cat .git/HEAD
ref: refs/heads/shared
> cat .git/refs/heads/shared
cat: .git/refs/heads/shared: No such file or directory

Is this intentional? How does Git find the numeric commit for HEAD?
Using find, I found my commit in these files:

Before "git gc" I found the commit ID in HEAD.

Why I'm worrying?: I tried to make a simple script that finds out the current 
HEAD-commit like this:
            if [ -d .git ]; then
                GIT_HEAD="Git:$GIT_BRANCH-$(cut -c1-7 .git/${GIT_HEAD##*: })"

Then $GIT_HEAD was something like "Git:shared-863962c".

Should I use code like this:?
awk '$2 == "refs/heads/shared" { print $1 }' .git/info/refs

Of course I'd be most pleased if there was some git builtin to get that (I read 
the manual without success).

Using an older version of Git (git-1.7.12)...

Ulrich Windl

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to