Skip to content

Instantly share code, notes, and snippets.

@galsi
Created March 16, 2021 09:56
Show Gist options
  • Save galsi/2c1ef0226dfa2d72dfff4faf858a1894 to your computer and use it in GitHub Desktop.
Save galsi/2c1ef0226dfa2d72dfff4faf858a1894 to your computer and use it in GitHub Desktop.
Quick Clone Git Repo
clonepath=/<FILL>
branchtoclone=<FILL>
checkoutfolder=<FILL>
repourl=https://...
echo '*************Quick Clone*******************'
echo 'Dircetory : ' $clonepath
echo 'Branch : '$branchtoclone
echo 'CheckOut Folder : '$checkoutfolder
echo '*******************************************'
time git clone --depth 1 --branch $branchtoclone --single-branch --sparse $repourl $clonepath
cd $clonepath
time git sparse-checkout add $checkoutfolder
read -n1 -rsp $'Press any key to continue or Ctrl+C to exit...\n'
@galsi
Copy link
Author

galsi commented Mar 16, 2021

Uses Git sparse-checkout feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment