Git development
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: "SZEDER Gábor" <szeder@ira.uka.de>
Cc: git@vger.kernel.org
Subject: Re: detached HEAD before root commit - possible?
Date: Sun, 23 Jun 2013 16:54:32 -0700	[thread overview]
Message-ID: <20130623235432.GA3024@elie.Belkin> (raw)
In-Reply-To: <20130623225505.GO20052@goldbirke>

Hi,

SZEDER Gábor wrote:

> $ git init
> Initialized empty Git repository in /tmp/test/.git/
> $ git checkout --detach
> fatal: You are on a branch yet to be born
>
> Are there some plumbing commands and options that would still allow
> this, or can I rely on that that it's impossible?

gitrepository-layout(5) tells me HEAD can be in one of a few states:

 a) Missing.  In this case the repository is considered to be
    corrupt and attempts to access the repository fail until the user
    runs "git init" to recover.

 b) A symbolic link, which is one way to represent a symref (pointing
    to an existing branch or an unborn branch).

 c) A standard symref, in the format "ref: refs/some/branch".  Behaves
    like (b).

 d) A direct SHA-1 reference (40-character commit object name)
    pointing to a commit without associating a branch ("detached HEAD").

 e) Anything else means the repository is corrupt, as in case (a).

In other words, HEAD always either points to an unborn or existing
branch or an existing commit.  It's not clear to me what it would
mean to detach from an unborn branch.

Improvements to the documentation to make that clearer would of course
be welcome. ;-)

Thanks,
Jonathan

  reply	other threads:[~2013-06-23 23:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-23 22:55 detached HEAD before root commit - possible? SZEDER Gábor
2013-06-23 23:54 ` Jonathan Nieder [this message]
2013-06-24  4:20   ` Martin von Zweigbergk
2013-06-24  5:01     ` Junio C Hamano
2013-06-24 10:41 ` Matthieu Moy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130623235432.GA3024@elie.Belkin \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=szeder@ira.uka.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox