Skip to content

Instantly share code, notes, and snippets.

@rheinardkorf
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rheinardkorf/9d49e293babffdc4d00e to your computer and use it in GitHub Desktop.
Save rheinardkorf/9d49e293babffdc4d00e to your computer and use it in GitHub Desktop.
#!/bin/bash
# A script I use daily to quickly zip up a git repo.
# Note you will need: https://github.com/Kentzo/git-archive-all
#
# Adaptation of: https://gist.github.com/uglyrobot/e872d1a9efc122b6bae2
if [[ $# -eq 0 ]] ; then
echo "Please enter a version number:"
read VERSION
else
VERSION=$1
fi
if [[ $2 -eq 0 ]] ; then
THEPATH="../"
else
THEPATH=$2
fi
if [[ -z "$VERSION" ]] ; then
echo "Sorry, I need a version number!"
exit 0
fi
NAME=${PWD##*/}
echo $THEPATH$NAME-$VERSION
git-archive-all --force-submodules --prefix $NAME/ $THEPATH$NAME-$VERSION.zip
@rheinardkorf
Copy link
Author

Added this as an alias to my shell and call it from inside the git repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment