git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Status after 'git clone --no-checkout' ?

From
Jeff King <peff@peff.net>
Date
Dec 1, 2011, 19:00 UTC
Message-ID
<20111201190058.GC2873@sigill.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
Previous: norbert.nemecNext: norbert.nemec
Message 2 of 3 in “Status after 'git clone --no-checkout' ?”
  1. norbert.nemecNov 30, 2011
  2. Jeff KingDec 1, 2011
  3. norbert.nemecDec 2, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.