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

Re: git reset --hard in .git causes a checkout in that directory

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 6, 2009, 07:54 UTC
Message-ID
<7vk4x0k059.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20091206041839.GB23983@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 12 quoted lines
> I actually considered that, too, when writing the patch. But that would
> be inconsistent with all of the other commands that use SETUP_WORK_TREE.
> For example:
>
>   $ git init && cd .git && git clean
>   fatal: This operation must be run in a work tree
>
> So I think we are better to be consistent with the other commands. If
> somebody wants to make a separate patch to discover the work tree while
> in the $GIT_DIR and chdir to it, that should then be applied to all
> commands.  I'm not opposed to it, but I also don't see it as a
> particularly pressing need.

Yes, we would of course want to do this consistently. I haven't followed the codepath yet, but I suspect this will end up being connected with running "rev-parse --show-cdup" inside .git/ of a non-bare repository.

Previous: Jeff King
Message 8 of 8 in “git reset --hard in .git causes a checkout in that directory”
  1. Maarten LankhorstDec 3, 2009
  2. Jeff KingDec 4, 2009
  3. Junio C HamanoDec 4, 2009
  4. Junio C HamanoDec 5, 2009
  5. Jeff KingDec 6, 2009
  6. Junio C HamanoDec 5, 2009
  7. Jeff KingDec 6, 2009
  8. Junio C HamanoDec 6, 2009

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.