Ideally, you could refer the whole world --- or at least, the significant portion thereof that want your code --- to your (public mirror) Git repository. But unfortunately, the whole world does not (yet) use Git ("I know it was you Fredo, I know it was you, and it breaks my heart."). Sad. Sooooo sad. But true. So the only recourse is for you to send these tortured souls an archived snapshot of your code via e-mail. I'll pause now to let you finish retching/sobbing/lamenting/venting. ... Back? Anyway, Git has a neat "
archive" command that helps you create the required archive, but perhaps it does not have the most friendliest interface in the world. I've written some scripts to wrap the Git command to facilitate its use, which I share here.
Update 2011-07-07: I have re-written the original three scripts previously described here as a single script, incorporating some of the excellent suggestions that kind folks provided in the comments. Immediately below this is the new, unified, all-bells-and-whistles-included script. Simply name it something like "git-makedist", switch on its executable bit, and place it somewhere on your system path. Reasonable names, filepaths, prefixes, etc. are all provided if you do not explicitly specify them. All of which means that, in most cases, once installed, simply invoking the command "
git makedist" without any options or arguments from within a Git repository "just works (tm)", resulting in a sensibly-named compressed archive of the current HEAD ready for distribution. At the same time, various flags and options allow you to fine-tune the operations, e.g. determine the compression/archive method, the path prefixes, the archive name, etc.
Update 2011-07-22, Excluding Files:
Sometimes, not all files need to make it out to an archive. You can use the "
.gitattributes" file to control which files get archived. Simply add the paths/names/globs of the files or directories you would like to exclude, and add a "
export-ignore" after it. For example:
Note that the "
.gitattributes" file has to be committed for it to have an effect.