How can I exclude README.md
from all sync/pull/push github requests? I wish to download/sync all files except that file.
Context: I have a repo for StreakyCobra style dotfiles management. I would like to add some notes to README.md
(showing up on github), but wish to avoid having the file in $HOME
on my computer.
Working off of @kba's comment, here's a solution that works:
You can enable sparse checkout for a repo with the following command: git config core.sparsecheckout true
Then edit the repository's .git/info/sparse-checkout
file to be:
/*
!README.md
which essentially says "checkout everything, except any file named README.md
". The format of sparse-checkout
works the same as a .gitignore
file.
Just tested this by checking out an existing repository, and it works. (Although, there's a catch-22 situation where you need an existing repository to configure the sparse checkout on, so I used git init
to create one, configured it, and then added the existing repo as a new remote).