Skip to content

Instantly share code, notes, and snippets.

@GeneralD
Created November 28, 2017 18:59
Show Gist options
  • Save GeneralD/9f3f6220543fce4a0e82f07a03e3fa6f to your computer and use it in GitHub Desktop.
Save GeneralD/9f3f6220543fce4a0e82f07a03e3fa6f to your computer and use it in GitHub Desktop.
#!/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