Skip to content

Instantly share code, notes, and snippets.

@l0neranger
Created October 16, 2014 22:55
Show Gist options
  • Save l0neranger/b60dbae6f571126fdae8 to your computer and use it in GitHub Desktop.
Save l0neranger/b60dbae6f571126fdae8 to your computer and use it in GitHub Desktop.
Create tar bundle of all files in a Git SHA - A Bash Function
function gpack() {
if [ -d ".git" ]; then
echo -n "List of files:" ; git show --pretty="format:" --name-only $1
if [ $? == 0 ]; then
git show --pretty="format:" --name-only $1 | xargs tar czf ../`printf '%q\n' "${PWD##*/}"`-partial-`cdate`.tar.gz
echo ; echo -n "Tar bundle: ../" ; ls -1t .. | head -n 1
else
echo "git SHA Not Found"
fi
else
return
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment