Created
October 16, 2014 22:55
-
-
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
This file contains 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
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