# Status after 'git clone --no-checkout' ?

3 messages from 2011-11-30 to 2011-12-02. Participants: norbert.nemec, Jeff King.
Thread: https://gitlist.dev/t/29054

## norbert.nemec, 2011-11-30 13:02

Subject: Status after 'git clone --no-checkout' ?
Message-ID: <jb59h0$p3e$1@dough.gmane.org>
URL: https://gitlist.dev/e/jb59h0%24p3e%241%40dough.gmane.org

```
Hi there,

what exactly is the status after 'git clone --no-checkout'? Is there any 
straightforward way how one could end up in this state starting from a 
regularly checked out repository?

A somewhat related question:

'git checkout' without any further options serves to move from the 
aforementioned special state to a regular checked out state. Otherwise 
it never seems to do anything. Are there any other situations where 'git 
checkout' on its own would have any effect?

Thanks for any insight on this!

Norbert Nemec

```

## Jeff King, 2011-12-01 19:00

Subject: Re: Status after 'git clone --no-checkout' ?
Message-ID: <20111201190058.GC2873@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20111201190058.GC2873%40sigill.intra.peff.net
In-Reply-To: <jb59h0$p3e$1@dough.gmane.org>

```
On Wed, Nov 30, 2011 at 02:02:22PM +0100, norbert.nemec wrote:

> what exactly is the status after 'git clone --no-checkout'? Is there
> any straightforward way how one could end up in this state starting
> from a regularly checked out repository?

You have a HEAD which points to some actual commit, but no index or
working tree. I don't think there is a particular name for this state.

You can get something similar in an existing repo by deleting all of the
working tree files and removing .git/index.

> 'git checkout' without any further options serves to move from the
> aforementioned special state to a regular checked out state.
> Otherwise it never seems to do anything. Are there any other
> situations where 'git checkout' on its own would have any effect?

By itself, I don't think so. But you can use "git checkout -f" to
discard changes in the index and working tree, setting them back to the
state in HEAD.

At one point, some people used "git checkout" as a no-op, because it
would print the "ahead/behind" information with respect to the upstream.
These days, that information is part of "git status", so I suspect
people use that instead.

-Peff

```

## norbert.nemec, 2011-12-02 07:53

Subject: Re: Status after 'git clone --no-checkout' ?
Message-ID: <jba050$uhs$1@dough.gmane.org>
URL: https://gitlist.dev/e/jba050%24uhs%241%40dough.gmane.org
In-Reply-To: <20111201190058.GC2873@sigill.intra.peff.net>

```
Thanks a lot for this concise explanation -- exactly what I was hoping for!


Am 01.12.11 20:00, schrieb Jeff King:
> On Wed, Nov 30, 2011 at 02:02:22PM +0100, norbert.nemec wrote:
>
>> what exactly is the status after 'git clone --no-checkout'? Is there
>> any straightforward way how one could end up in this state starting
>> from a regularly checked out repository?
>
> You have a HEAD which points to some actual commit, but no index or
> working tree. I don't think there is a particular name for this state.
>
> You can get something similar in an existing repo by deleting all of the
> working tree files and removing .git/index.
>
>> 'git checkout' without any further options serves to move from the
>> aforementioned special state to a regular checked out state.
>> Otherwise it never seems to do anything. Are there any other
>> situations where 'git checkout' on its own would have any effect?
>
> By itself, I don't think so. But you can use "git checkout -f" to
> discard changes in the index and working tree, setting them back to the
> state in HEAD.
>
> At one point, some people used "git checkout" as a no-op, because it
> would print the "ahead/behind" information with respect to the upstream.
> These days, that information is part of "git status", so I suspect
> people use that instead.
>
> -Peff

```
