Skip to content

Instantly share code, notes, and snippets.

@lastobelus
Created January 20, 2017 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lastobelus/eee2b44dea8e26c1b1e95b3c56ab4361 to your computer and use it in GitHub Desktop.
Save lastobelus/eee2b44dea8e26c1b1e95b3c56ab4361 to your computer and use it in GitHub Desktop.
function glone {
gh_url=${1:-`pbpaste`}
repo_name=$(basename $gh_url | sed -e 's/\.git//')
co_dir=${HOME}/github/${repo_name}
if [ -d $co_dir ]; then
cd $co_dir && git pull origin master
else
git clone "${gh_url}" "${co_dir}" && cd "${co_dir}"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment