Question
Is there a way to define patterns to not pull files from the git server on a git clone
or git fetch
? This may be called a "reverse git ignore".
Problem
What I have is a repository of dotfiles and I want to have a readme in the root of the project that is named README.md
. With this file GitHub can display it with nice formatting.
As the repo is to be checked out in the user's home folder on a *NIX machine, all the dotfiles will be hidden as intended, but the README.md
will not and that is not desired.
So I do not want the README.md
to be pulled when the repo is cloned. How to achieve that?
Alternative solution
If the above desired result is not possible, can the README.md
be hidden or obscured in the home folder through some other method?
Example of problem
If it helps, here is the dotfiles repository I am working on.
While it is possible to not download files with partial clone, those files will be implicitly downloaded once the working tree is checked out. If your goal is to ignore certain files for a dotfiles repository, you have some options:
README.md
as export-ignore
in .gitattributes
and use git archive
to copy the files into place.README.md
from checkout. See git-sparse-checkout(1)
for more details.README.md
file.