Last active
December 17, 2015 13:49
-
-
Save kristm/5619905 to your computer and use it in GitHub Desktop.
tarbecue - when your git repo is unreachable from the network
This file contains hidden or 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
#!/bin/bash | |
usage="Tarbecue\nUsage: $0 <tarfile> [commit id]" | |
if [ $# -lt 1 ]; then | |
echo -e $usage | |
exit | |
elif [ $# -lt 2 ]; then | |
commit="" | |
else | |
commit=$2 | |
fi | |
for i in $(git diff --name-only $commit); do | |
if [ ! -f $1 ]; then | |
tar -cvf $1 $i | |
else | |
tar -rvf $1 $i | |
fi | |
done | |
if [ -e $1 ]; then gzip $1; fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment