Created
November 28, 2017 18:59
-
-
Save GeneralD/9f3f6220543fce4a0e82f07a03e3fa6f to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env zsh | |
if [[ $# -lt 2 ]]; then | |
echo "Usage: ${0##*/} [repo's url] [directory you want to clone]" | |
exit | |
fi | |
local dir=${1##*/} | |
mkdir $dir | |
local tmpdir=`pwd` | |
cd $dir | |
git init | |
git config core.sparsecheckout true | |
git remote add -f origin $1 | |
echo $2 > .git/info/sparse-checkout | |
git pull origin master | |
cd $tmpdir |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment