Created
June 1, 2020 07:34
-
-
Save kenpusney/c217bfc8b6233695ab58eeb86f9beb5f to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env bash | |
# Subtree archive script | |
# ------- | |
# | |
# Archive your repos into single and keeps all commit history. | |
# | |
# Please change github username before you use. | |
REPO=$1 | |
BRANCH=${2:-"master"} | |
USER=kenpusney | |
die() { | |
echo $1 | |
exit -1; | |
} | |
[ -z $REPO ] && die "error, usage \`${0} \$REPO [\$BRANCH]\`" | |
git remote add subtree-${REPO} git@github.com:${USER}/${REPO}.git | |
git subtree add --prefix=${REPO} subtree-${REPO} ${BRANCH} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment