Last active
July 7, 2017 15:39
-
-
Save azu/8205567 to your computer and use it in GitHub Desktop.
git clone --recursive & cd
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
function gcd { | |
if [ ! -n "$1" ]; then | |
echo "Usage: gcd git://example.com/repo.git" | |
return; | |
fi | |
declare url=$1; | |
declare reponame=$(echo $url | awk -F/ '{print $NF}' | sed -e 's/.git$//'); | |
if [ -d "$reponame" ]; then | |
cd $reponame; | |
return; | |
fi | |
git clone --recursive $url $reponame; | |
echo "\033[31m=>\033[0m \033[036m$reponame\033[0m" | |
cd $reponame; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment