git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* No working tree repository
@ 2010-06-15 17:56 Phillip Susi
  2010-06-15 18:10 ` Matthieu Moy
  0 siblings, 1 reply; 8+ messages in thread
From: Phillip Susi @ 2010-06-15 17:56 UTC (permalink / raw)
  To: git

I'd like to keep a local copy of the kernel repository mainly for
searching the history.  The working tree uses up nearly 400mb of disk
space that I do not normally need.  How can I remove the working tree,
and keep only the packed repository so I can review the logs, and only
check out a working copy if I actually want to edit or compile the sources?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: No working tree repository
  2010-06-15 17:56 No working tree repository Phillip Susi
@ 2010-06-15 18:10 ` Matthieu Moy
  2010-06-15 18:33   ` Phillip Susi
  2010-06-15 19:39   ` Andreas Schwab
  0 siblings, 2 replies; 8+ messages in thread
From: Matthieu Moy @ 2010-06-15 18:10 UTC (permalink / raw)
  To: Phillip Susi; +Cc: git

Phillip Susi <psusi@cfl.rr.com> writes:

> I'd like to keep a local copy of the kernel repository mainly for
> searching the history.  The working tree uses up nearly 400mb of disk
> space that I do not normally need.  How can I remove the working tree,
> and keep only the packed repository so I can review the logs, and only
> check out a working copy if I actually want to edit or compile the
> sources?

This is called a "bare" repository. Now, you have the keyword to
RTFM ;-).

You can do something like

mv linux-repo linux-tree
cd linux-tree
mv .git ../linux-repo
cd ../linux-repo
git config core.bare true

(and optionnaly remove linux-tree/)

or you could have used "git clone --bare" when you cloned the
repository.

-- 
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:10 ` Matthieu Moy
@ 2010-06-15 18:33   ` Phillip Susi
  2010-06-15 20:41     ` Wesley J. Landaker
                       ` (3 more replies)
  2010-06-15 19:39   ` Andreas Schwab
  1 sibling, 4 replies; 8+ messages in thread
From: Phillip Susi @ 2010-06-15 18:33 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git

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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: No working tree repository
  2010-06-15 18:10 ` Matthieu Moy
  2010-06-15 18:33   ` Phillip Susi
@ 2010-06-15 19:39   ` Andreas Schwab
  1 sibling, 0 replies; 8+ messages in thread
From: Andreas Schwab @ 2010-06-15 19:39 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: Phillip Susi, git

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> You can do something like
>
> mv linux-repo linux-tree
> cd linux-tree
> mv .git ../linux-repo
> cd ../linux-repo
> git config core.bare true

Or shorter:

$ git clone --bare linux-repo

(which creates linux-repo.git and uses hardlinks, so it won't waste
space)

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ 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
                       ` (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

end of thread, other threads:[~2010-06-16  8:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-15 17:56 No working tree repository Phillip Susi
2010-06-15 18:10 ` Matthieu Moy
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
2010-06-15 19:39   ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).