Skip to content

Instantly share code, notes, and snippets.

@irohiroki
Created February 1, 2011 09:14
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 irohiroki/805622 to your computer and use it in GitHub Desktop.
Save irohiroki/805622 to your computer and use it in GitHub Desktop.
A shell function that clones a github project into a directory of its account name.
# clone a github project
function clone {
# check arguments
acc=${1%%/*}
prj=${1##*/}
if [ -z "$acc" -o -z "$prj" ] ; then
echo 'usage: clone <github_account>/<project>'
return 1
fi
# mkdir of the account name
if [ ! -d "$acc" ] ; then
mkdir $acc || return 1
fi
git clone https://github.com/$acc/$prj.git $acc/$prj
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment