* Re: No working tree repository
2010-06-15 18:33 ` Phillip Susi
@ 2010-06-15 20:41 ` Wesley J. Landaker
2010-06-15 20:58 ` Matthieu Moy
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Wesley J. Landaker @ 2010-06-15 20:41 UTC (permalink / raw)
To: Phillip Susi, git
[-- Attachment #1: Type: Text/Plain, Size: 1084 bytes --]
On Tuesday, June 15, 2010 12:33:32 Phillip Susi wrote:
> 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.
[-- Attachment #2: git-emptybranch --]
[-- Type: application/x-shellscript, Size: 322 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: No working tree repository
2010-06-15 18:33 ` Phillip Susi
2010-06-15 20:41 ` Wesley J. Landaker
@ 2010-06-15 20:58 ` Matthieu Moy
2010-06-16 6:20 ` Johannes Sixt
2010-06-16 8:36 ` Peter Krefting
3 siblings, 0 replies; 8+ messages in thread
From: Matthieu Moy @ 2010-06-15 20:58 UTC (permalink / raw)
To: Phillip Susi; +Cc: git
Phillip Susi <psusi@cfl.rr.com> writes:
> On 6/15/2010 2:10 PM, Matthieu Moy wrote:
>> This is called a "bare" repository. Now, you have the keyword to
>> RTFM ;-).
>
> 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.
rm -fr * # use at your own risk
rm -f .git/index
Then, you can get back a tree with "git checkout" or "git checkout
HEAD -- .". The advantage of this solution over the empty-branch
solution is that although you destroyed your index, HEAD is still
there so "git log" and friends will show you where you are.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: No working tree repository
2010-06-15 18:33 ` Phillip Susi
2010-06-15 20:41 ` Wesley J. Landaker
2010-06-15 20:58 ` Matthieu Moy
@ 2010-06-16 6:20 ` Johannes Sixt
2010-06-16 8:36 ` Peter Krefting
3 siblings, 0 replies; 8+ messages in thread
From: Johannes Sixt @ 2010-06-16 6:20 UTC (permalink / raw)
To: Phillip Susi; +Cc: Matthieu Moy, git
Am 6/15/2010 20:33, schrieb Phillip Susi:
> but I can't figure out how to empty the index.
git rm -r .
-- Hannes
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: No working tree repository
2010-06-15 18:33 ` Phillip Susi
` (2 preceding siblings ...)
2010-06-16 6:20 ` Johannes Sixt
@ 2010-06-16 8:36 ` Peter Krefting
3 siblings, 0 replies; 8+ messages in thread
From: Peter Krefting @ 2010-06-16 8:36 UTC (permalink / raw)
To: Phillip Susi; +Cc: Matthieu Moy, Git Mailing List
Phillip Susi:
> 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?
Then I would recommend creating another clone. I usually do a
git clone --reference path/to/bare server:path/to/origin newcheckout
to create clones with working trees, without having to pay the penalty of
having (yet) another copy of the objects under .git (and with .git in the
order of 400 megabytes, and several working copies, it does pay off).
Maintaining this is a lot easier than constantly adding and removing a
working tree from the repository.
If you only need a single file, "git show commit:path" should work, even on
a bare repository.
--
\\// Peter - http://www.softwolves.pp.se/
^ permalink raw reply [flat|nested] 8+ messages in thread