mschecht
11/6/2017 - 9:24 AM

git_sparse_checkout

This is how to grab only the directories you want from a git repo.

git init <repo>
cd <repo>
git remote add -f origin <url>

# This creates an empty repository with your remote. Then do:

git config core.sparsecheckout true

# Now you need to define which files/folders you want to actually check out. This is done by listing them in .git/info/sparse-checkout, eg:

echo some/dir/ >> .git/info/sparse-checkout
echo another/sub/tree >> .git/info/sparse-checkout

# Run this command for some fucking reason
git read-tree -m -u HEAD

# Last but not least, update your empty repo with the state from the remote:

git pull origin master

How to save git username and password

credit: https://stackoverflow.com/questions/35942754/how-to-save-username-and-password-in-git

Tell github to save credentials

git config credential.helper store
git pull

# then make a change
echo "test" > README_test.md
# rm later

git push

# enter username and password

Now it should be saved