Created
September 7, 2017 14:06
-
-
Save jfsanchez91/9b550643561a177574608ecde9f7f8e8 to your computer and use it in GitHub Desktop.
Bash function to zip a git project using git clone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Author: Jorge Fernández Sánchez <jfsanchez.email@gmail.com> | |
#This function clone a git project and makes (in the working directory) a zip file with the project content. | |
#project packing from git | |
function git_pack { | |
_PWD=$PWD | |
GIT_PATH=$1 | |
GIT_PROJECT=`/usr/bin/basename $GIT_PATH` | |
OUTPUT_ZIP="$_PWD/$GIT_PROJECT.zip" | |
TMP_PATH="/var/tmp/" | |
cd $TMP_PATH | |
TMP_PATH="$TMP_PATH/$GIT_PROJECT" | |
git clone $GIT_PATH | |
zip -r $OUTPUT_ZIP $GIT_PROJECT | |
cd $_PWD | |
rm -rf $TMP_PATH | |
echo "[SUCCESS] Project packed!" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment