Skip to content

Instantly share code, notes, and snippets.

@goldbattle
Created December 17, 2013 15:54
Show Gist options
  • Save goldbattle/8007145 to your computer and use it in GitHub Desktop.
Save goldbattle/8007145 to your computer and use it in GitHub Desktop.
BRANCH=master
REMOTE_REPOSITORY=https://github.com/Soartex-Modded/Modded-1.6.x.git
TMP_DIR=./tmp/modded-1.6.x/
TARGET_DIR=./modded-1.6.x/
VERSION_FILE=./$TARGET_DIR/version.txt
# Clone data from github
git clone --depth=1 --branch $BRANCH $REMOTE_REPOSITORY $TMP_DIR
# Fetch information
git fetch origin $BRANCH
# Hard reset git clone
git --git-dir="$TMP_DIR.git" --work-tree="$TMP_DIR" reset --hard origin/$BRANCH
# Pull the changes
git pull
# Not sure what this does.
git submodule update --init --recursive
# Create a version file we use in the zipmanger
git --git-dir="$TMP_DIR.git" --work-tree="$TMP_DIR" describe --always > $VERSION_FILE
# Create target zip directory if needed
if ![test -d $TARGET_DIR]; then mkdir $TARGET_DIR; fi
# Zip files, only if changed
for i in */; do cd "${i%/}"; zip -u -r "../$TARGET_DIR${i%/}.zip" "."; cd ../; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment