Instantly share code, notes, and snippets.

Embed
What would you like to do?
git-subtree support shell.
#!/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