Skip to content

Instantly share code, notes, and snippets.

@timabell
Created May 10, 2011 22:03
Show Gist options
  • Save timabell/965475 to your computer and use it in GitHub Desktop.
Save timabell/965475 to your computer and use it in GitHub Desktop.
create git tarballs easily
#!/bin/sh
if [ -z "$1" ]
then
rev="HEAD"
else
rev=$1
fi
wd=`pwd`
basepath=`basename $wd`
desc=$(git describe --always "$rev")
prefix="$basepath-$desc"
echo "creating archive $prefix.tar.gz..."
git archive --format=tar --prefix="$prefix/" "$rev" | gzip > "$prefix.tar.gz"
echo "done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment