Skip to content

Instantly share code, notes, and snippets.

@azu
Last active July 7, 2017 15:39
Show Gist options
  • Save azu/8205567 to your computer and use it in GitHub Desktop.
Save azu/8205567 to your computer and use it in GitHub Desktop.
git clone --recursive & cd
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