Last active
October 8, 2018 08:44
-
-
Save takashicompany/4861504c123e5b2c0778fc4d411f27e6 to your computer and use it in GitHub Desktop.
git-subtree support shell.
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
#!/bin/bash | |
repo=<subtree-repo path> | |
remote=<subtree-repo remote name> | |
branch=<subtree branch> | |
path=<local subtree path> | |
if [ $# -eq 0 ]; then | |
echo "this is git-subtree-suppot tool.\noptions:\n init\n pull\n push" | |
exit 1 | |
fi | |
if [ $1 = init ]; then | |
git remote add ${remote} ${repo} | |
git fetch ${remote} | |
git subtree add --prefix=${path} ${remote} ${branch} | |
elif [ $1 = pull ] ; then | |
git subtree pull --prefix=${path} ${remote} ${branch} | |
elif [ $1 = push ] ; then | |
git subtree push --prefix=${path} ${remote} ${branch} | |
else | |
echo "$1 option not found" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment