What does the “control chapter” do?

I tried the following out of curiosity:

git checkout head 

And I got this:

 $ git checkout head Note: checking out 'head'. You are in 'detached HEAD' state. Me@MyPC /c/repo ((9da1bd7...)) $ 

While

 git checkout head 

does nothing (as expected). So what does the first team do?

Additional Information: Yes, I am on Windows. And he did not create a tag or branch, as far as I can tell:

 Me@MyPC /c/repo ((9da1bd7...)) $ git log -n 1 commit 9da1bd740434923ae55ca1b50efb7c62eb6e0c35 Author: someone else Date: Fri Dec 6 15:44:08 2013 +0100 Me@MyPC /c/repo ((9da1bd7...)) $ git tag -l TestRelease Me@MyPC /c/repo ((9da1bd7...)) $ git branch -l * (detached from head) master 
+7
git
source share
2 answers

In https://github.com/git/git/blob/ad7044857660af7ffaaf8fbbccc77b817d1b938f/builtin/checkout.c#L624 the string "HEAD" has a special form as no-op, with strcmp (case sensitive). Elsewhere on the git system, something is parsing the checkout argument case-insensitively (or looks like a file name, which makes it possibly case insensitive depending on the file system).

+6
source share

From what you indicated. I would think that you have a head tag that points to the last commit in the branch you are currently in.

I tried to do what you did on a clean repo (tested on Ubuntu), and it complained about a non-existent head branch.

 $git init $git checkout head head error: pathspec 'head' did not match any file(s) known to git. 
+1
source share

All Articles