{"thread":{"id":"24122","subject":"No working tree repository","startedAt":"2010-06-15T17:56:07Z","lastAt":"2010-06-16T08:36:27Z","messageCount":8,"participants":["Phillip Susi","Matthieu Moy","Andreas Schwab","Wesley J. Landaker","Johannes Sixt","Peter Krefting"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"143773","messageId":"4C17BEB7.90403@cfl.rr.com","threadId":"24122","inReplyTo":null,"subject":"No working tree repository","fromName":"Phillip Susi","fromEmail":"psusi@cfl.rr.com","sentAt":"2010-06-15T17:56:07Z","receivedAt":"2010-06-15T17:56:07Z","isPatch":false,"sender":{"key":"psusi@cfl.rr.com","avatar":null},"body":"I'd like to keep a local copy of the kernel repository mainly for\nsearching the history.  The working tree uses up nearly 400mb of disk\nspace that I do not normally need.  How can I remove the working tree,\nand keep only the packed repository so I can review the logs, and only\ncheck out a working copy if I actually want to edit or compile the sources?\n"},{"id":"143774","messageId":"vpqy6egi2va.fsf@bauges.imag.fr","threadId":"24122","inReplyTo":"4C17BEB7.90403@cfl.rr.com","subject":"Re: No working tree repository","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-06-15T18:10:01Z","receivedAt":"2010-06-15T18:10:01Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Phillip Susi <psusi@cfl.rr.com> writes:\n\n> I'd like to keep a local copy of the kernel repository mainly for\n> searching the history.  The working tree uses up nearly 400mb of disk\n> space that I do not normally need.  How can I remove the working tree,\n> and keep only the packed repository so I can review the logs, and only\n> check out a working copy if I actually want to edit or compile the\n> sources?\n\nThis is called a \"bare\" repository. Now, you have the keyword to\nRTFM ;-).\n\nYou can do something like\n\nmv linux-repo linux-tree\ncd linux-tree\nmv .git ../linux-repo\ncd ../linux-repo\ngit config core.bare true\n\n(and optionnaly remove linux-tree/)\n\nor you could have used \"git clone --bare\" when you cloned the\nrepository.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"143775","messageId":"4C17C77C.9000002@cfl.rr.com","threadId":"24122","inReplyTo":"vpqy6egi2va.fsf@bauges.imag.fr","subject":"Re: No working tree repository","fromName":"Phillip Susi","fromEmail":"psusi@cfl.rr.com","sentAt":"2010-06-15T18:33:32Z","receivedAt":"2010-06-15T18:33:32Z","isPatch":false,"sender":{"key":"psusi@cfl.rr.com","avatar":null},"body":"On 6/15/2010 2:10 PM, Matthieu Moy wrote:\n> This is called a \"bare\" repository. Now, you have the keyword to\n> RTFM ;-).\n\nAhh, that's the magic word I was groping for.\n\nIt seems that --bare on clone will prevent the checkout of the local\nworking tree.  If I decide I do want the sources today I can just check\nthem out, but what is the proper way to do the reverse?  I was thinking\nsomething like somehow empty the index file then do a git-reset or\ngit-checkout-index to clean up the working tree to match the empty\nindex, but I can't figure out how to empty the index.\n"},{"id":"143779","messageId":"m2ocfcw0f1.fsf@igel.home","threadId":"24122","inReplyTo":"vpqy6egi2va.fsf@bauges.imag.fr","subject":"Re: No working tree repository","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2010-06-15T19:39:14Z","receivedAt":"2010-06-15T19:39:14Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> You can do something like\n>\n> mv linux-repo linux-tree\n> cd linux-tree\n> mv .git ../linux-repo\n> cd ../linux-repo\n> git config core.bare true\n\nOr shorter:\n\n$ git clone --bare linux-repo\n\n(which creates linux-repo.git and uses hardlinks, so it won't waste\nspace)\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"143783","messageId":"201006151441.35554.wjl@icecavern.net","threadId":"24122","inReplyTo":"4C17C77C.9000002@cfl.rr.com","subject":"Re: No working tree repository","fromName":"Wesley J. Landaker","fromEmail":"wjl@icecavern.net","sentAt":"2010-06-15T20:41:34Z","receivedAt":"2010-06-15T20:41:34Z","isPatch":false,"sender":{"key":"wjl@icecavern.net","avatar":"https://avatars.githubusercontent.com/u/67229?v=4"},"body":"On Tuesday, June 15, 2010 12:33:32 Phillip Susi wrote:\n> Ahh, that's the magic word I was groping for.\n> \n> It seems that --bare on clone will prevent the checkout of the local\n> working tree.  If I decide I do want the sources today I can just check\n> them out, but what is the proper way to do the reverse?  I was thinking\n> something like somehow empty the index file then do a git-reset or\n> git-checkout-index to clean up the working tree to match the empty\n> index, but I can't figure out how to empty the index.\n\nI often want to have a regular tree, but only sometimes check it out, and I \nwant it to be in-place (e.g. not a bare repository and a separate work-\ntree).\n\nWhat I do is I make a local \"empty\" branch with no files or ancestory. For \nthis I have a \"git-emptybranch\" script (attached), but you can easily do \nthis by hand.\n\nThen when I want files, I do:\n\n$ git checkout master  ## or whatever branch\n\nWhen I'm done, I do\n\n$ git checkout empty\n\nand all the files go away.\n\nEven with empty checked out, I can fetch, push, run gitk --all, etc.\n\nThis works well for me.\n"},{"id":"143785","messageId":"vpq7hm0dndf.fsf@bauges.imag.fr","threadId":"24122","inReplyTo":"4C17C77C.9000002@cfl.rr.com","subject":"Re: No working tree repository","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2010-06-15T20:58:20Z","receivedAt":"2010-06-15T20:58:20Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Phillip Susi <psusi@cfl.rr.com> writes:\n\n> On 6/15/2010 2:10 PM, Matthieu Moy wrote:\n>> This is called a \"bare\" repository. Now, you have the keyword to\n>> RTFM ;-).\n>\n> Ahh, that's the magic word I was groping for.\n>\n> It seems that --bare on clone will prevent the checkout of the local\n> working tree.  If I decide I do want the sources today I can just check\n> them out, but what is the proper way to do the reverse?  I was thinking\n> something like somehow empty the index file then do a git-reset or\n> git-checkout-index to clean up the working tree to match the empty\n> index, but I can't figure out how to empty the index.\n\nrm -fr *  # use at your own risk\nrm -f .git/index\n\nThen, you can get back a tree with \"git checkout\" or \"git checkout\nHEAD -- .\". The advantage of this solution over the empty-branch\nsolution is that although you destroyed your index, HEAD is still\nthere so \"git log\" and friends will show you where you are.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"143810","messageId":"4C186D45.7030203@viscovery.net","threadId":"24122","inReplyTo":"4C17C77C.9000002@cfl.rr.com","subject":"Re: No working tree repository","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2010-06-16T06:20:53Z","receivedAt":"2010-06-16T06:20:53Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 6/15/2010 20:33, schrieb Phillip Susi:\n> but I can't figure out how to empty the index.\n\ngit rm -r .\n\n-- Hannes\n"},{"id":"143817","messageId":"alpine.DEB.2.00.1006160933270.10800@ds9.cixit.se","threadId":"24122","inReplyTo":"4C17C77C.9000002@cfl.rr.com","subject":"Re: No working tree repository","fromName":"Peter Krefting","fromEmail":"peter@softwolves.pp.se","sentAt":"2010-06-16T08:36:27Z","receivedAt":"2010-06-16T08:36:27Z","isPatch":false,"sender":{"key":"peter@softwolves.pp.se","avatar":"https://avatars.githubusercontent.com/u/990764?v=4"},"body":"Phillip Susi:\n\n> It seems that --bare on clone will prevent the checkout of the local \n> working tree. If I decide I do want the sources today I can just check \n> them out, but what is the proper way to do the reverse?\n\nThen I would recommend creating another clone. I usually do a\n\n   git clone --reference path/to/bare server:path/to/origin newcheckout\n\nto create clones with working trees, without having to pay the penalty of \nhaving (yet) another copy of the objects under .git (and with .git in the \norder of 400 megabytes, and several working copies, it does pay off).\n\nMaintaining this is a lot easier than constantly adding and removing a \nworking tree from the repository.\n\n\nIf you only need a single file, \"git show commit:path\" should work, even on \na bare repository.\n\n-- \n\\\\// Peter - http://www.softwolves.pp.se/\n"}]}