On Mon, May 17, 2010 at 06:53:55AM -0400, Eli Barzilay wrote: > Say that I have a repository at /some/dir, and a tree that contains > most of its files at /another/dir (the second is a build directory, > made with `git archive', so some files removed due to export-ignore > attributes and some built files are present). > > Is there a convenient way to make /some/dir usable as a repository? Did you mean /another/dir? /some/dir is already a repository as per your description above (is it a bare repository or a regular one?). > Two things that I tried are > > git --work-tree=/another/dir reset --hard master > > which one time, but then failed with "fatal: unable to read tree...", > and another is I would have thought that worked, assuming you were in /some/dir. And oddly, _some_ stuff works. I tried: mkdir repo && cd repo && git init echo content >file && git add . && git commit -m file git archive --format=tar --prefix=work/ HEAD | tar -C .. -xf - to create the situation. Running cd repo git --work-tree=$PWD/../work diff-files git --work-tree=$PWD/../work diff works as expected (the first one notices stat-dirtiness, and the second shows an empty diff). But then I get: $ git --work-tree=$PWD/../work reset --hard fatal: unable to read tree ea394696ee1f7f5b55ca0d97d37748933cf39095 So there is clearly a bug. I'll investigate. > cp -a /some/dir/.git /another/dir > cd /another/dir > git reset --hard master > > which looks like it can suffer from the same problem. That should work, too. > (It would be especially nice if there's a way to have only different > files touched in /another/dir.) Only different files will be rewritten, but git will have to read all of the files to determine their sha1 (usually it avoids this by checking stat info, but obviously your exported files will not match the stat info in the /another/dir's index). -Peff -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html