Created
November 8, 2017 20:36
-
-
Save spboyer/f6e7b393fe0dbba102d32c05a76610e5 to your computer and use it in GitHub Desktop.
GitClone
This file contains hidden or 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
# Git clone shortcut, assumes spboyer by default | |
# usage: clone <user> <repo name> | |
function clone { | |
# customize username to your own | |
local username="spboyer" | |
local url=$1; | |
local repo=$2; | |
if [[ ${url:0:4} == 'http' || ${url:0:3} == 'git' ]] | |
then | |
# just clone this thing. | |
repo=$(echo $url | awk -F/ '{print $NF}' | sed -e 's/.git$//'); | |
elif [[ -z $repo ]] | |
then | |
# my own stuff. | |
repo=$url; | |
url="[email protected]:$username/$repo"; | |
else | |
# not my own, but I know whose it is. | |
url="[email protected]:$url/$repo.git"; | |
fi | |
git clone $url $repo && cd $repo && code-insiders .; | |
} | |
# end clone |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment