Last active
August 29, 2015 14:08
-
-
Save ayushgoel/9af1e69bf0f544e1b79b to your computer and use it in GitHub Desktop.
Easily add git subtree
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 | |
if [ $# -lt 2 ] | |
then | |
echo "ERROR: Less arguments." | |
echo "Usage: git-subtree-add <git-url> <ref(commit)>" | |
else | |
REPO_NAME=`echo $1 | sed 's%^.*/\([^/]*\)\.git$%\1%g'` | |
echo "Adding subtree for " | |
echo $REPO_NAME | |
PREFIX="lib/"$REPO_NAME | |
git subtree add --prefix=$PREFIX --squash $1 $2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment