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

Re: No working tree repository

From
Wesley J. Landaker <wjl@icecavern.net>
Date
Jun 15, 2010, 20:41 UTC
Message-ID
<201006151441.35554.wjl@icecavern.net>
In-Reply-To
<4C17C77C.9000002@cfl.rr.com>
On Tuesday, June 15, 2010 12:33:32 Phillip Susi wrote:
Show 8 quoted lines
> Ahh, that's the magic word I was groping for.
> 
> It seems that --bare on clone will prevent the checkout of the local
> working tree.  If I decide I do want the sources today I can just check
> them out, but what is the proper way to do the reverse?  I was thinking
> something like somehow empty the index file then do a git-reset or
> git-checkout-index to clean up the working tree to match the empty
> index, but I can't figure out how to empty the index.

I often want to have a regular tree, but only sometimes check it out, and I want it to be in-place (e.g. not a bare repository and a separate work- tree).

What I do is I make a local "empty" branch with no files or ancestory. For this I have a "git-emptybranch" script (attached), but you can easily do this by hand.

Then when I want files, I do:
$ git checkout master  ## or whatever branch
When I'm done, I do
$ git checkout empty
and all the files go away.
Even with empty checked out, I can fetch, push, run gitk --all, etc.
This works well for me.
Previous: Phillip SusiNext: Matthieu Moy
Message 4 of 8 in “No working tree repository”
  1. Phillip SusiJun 15, 2010
  2. Matthieu MoyJun 15, 2010
  3. Phillip SusiJun 15, 2010
  4. Wesley J. LandakerJun 15, 2010
  5. Matthieu MoyJun 15, 2010
  6. Johannes SixtJun 16, 2010
  7. Peter KreftingJun 16, 2010
  8. Andreas SchwabJun 15, 2010

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.