Add support for cloning a branch by using a URL fragment. (No tag support... yet.)

This commit is contained in:
William Hilton 2015-12-09 16:26:16 -05:00
parent 44b7f60163
commit 2e5d80c63d

15
bin/get
View file

@ -272,8 +272,19 @@ then
else
url="$2"
fi
echo Cloning $url
git clone --recurse-submodules "$url"
# Extract branch from URL
if [[ "$url" == *"#"* ]]
then
clone_branch=${url##*#}
url=${url%#*}
fi
# Default to master branch if no branch in URL
clone_branch=${clone_branch:-master}
echo "Cloning $clone_branch branch of $url"
git clone --recurse-submodules -b $clone_branch "$url"
;;
squash)