Skip to content

Instantly share code, notes, and snippets.

@spboyer
Created November 8, 2017 20:36
Show Gist options
  • Save spboyer/f6e7b393fe0dbba102d32c05a76610e5 to your computer and use it in GitHub Desktop.
Save spboyer/f6e7b393fe0dbba102d32c05a76610e5 to your computer and use it in GitHub Desktop.
GitClone
# 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