Skip to content

Instantly share code, notes, and snippets.

@kristm
Last active December 17, 2015 13:49
Show Gist options
  • Save kristm/5619905 to your computer and use it in GitHub Desktop.
Save kristm/5619905 to your computer and use it in GitHub Desktop.
tarbecue - when your git repo is unreachable from the network
#!/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