Skip to content

Instantly share code, notes, and snippets.

@haruair
Last active August 29, 2015 14:01
Show Gist options
  • Save haruair/5a2526ad319949ea14fb to your computer and use it in GitHub Desktop.
Save haruair/5a2526ad319949ea14fb to your computer and use it in GitHub Desktop.
Git diff the extract as a zip file
#!/bin/bash
NOW=$(date +"%Y-%m-%d-%H%M%S")
DIFF=$(git diff --name-only deploy HEAD)
TOPLEVEL=$(git rev-parse --show-toplevel)
CURRENT=$(pwd)
if [ -z "$DIFF" ]
then
echo "😝 Sorry no diff in there."
else
cd "$TOPLEVEL"
zip ../$NOW.zip $DIFF
git diff deploy HEAD > ../$NOW.changed.txt
open ..
git tag -f deploy HEAD
cd "$CURRENT"
echo "🍺 All done. good job!"
fi
# this script run with deploy tag
# put the file into any $PATH with good permission
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment