Basics¶
Cloning¶
Sparse Checkout¶
git clone --filter=blob:none --sparse --no-checkout https://github.com/user_or_org/repo_name
# move to git folder
cd repo_name
# set sparse
# git sparse-checkout set --cone
# select branch
git checkout main
# clone specific folder
git sparse-checkout add ./folder
# clone specific file
git sparse-checkout add ./folder/file
Shallow¶
Refresh Repo¶
Go to repo local folder Right-click > Git Bash here
git checkout main
git checkout --orphan last
git add -A
git commit -am "Repo Refresh"
git branch -D main
git branch -m main
git gc --aggressive --prune=all
git push -f origin main
git checkout gh-pages
git checkout --orphan last
git add -A
git commit -am "Repo Refresh"
git branch -D gh-pages
git branch -m gh-pages
git gc --aggressive --prune=all
git push -f origin gh-pages
Rebase¶
Rename/Moving File¶
This avoids Git thinking that the files were deleted & added, thus reducing repo size