tags:

views:

167

answers:

2

Hi All,

I can't seem to find the answer to this seemingly simple question, anywhere: How do you acquire a clean copy of a code repository once you "release" it? For instance, say I'm at a place in my Git repository where I want to release a copy. How do I copy it without all the Gitiness? I don't want any hidden Git directories, etc. I want a clean deliverable product. Ideas? I'm working with RoR, btw.

Best

+4  A: 

In your git directory, there's really only one directory that is "gitty," and that is .git.

Here's what I propose, you check out your release branch and copy it elsewhere, except for the .git folder. This packs your working directory into a tarball:

$tar --exclude .git -cjf release.tar.bz2 *
nes1983
What about `.gitignore` files? Aren't those also "gitty"? This would include those in the tarball. I'm not sure if `git archive` will exclude them by default, but it might. If it doesn't, it could be configured to do so with the `export-ignore` attribute.
Dan Moulding
+10  A: 

You may want git archive, e.g.

git archive --format=tar -o /path/to/archive.tar master

Note that the above gets you a whole tree. If you want, can pare it down to only specific directories, including going down multiple "levels":

git archive --format=tar -o /path/to/archive.tar master somedir/ another/dir/
Nicholas Knight