I can tell Git where the Git repository is with --git-dir
. I can tell Git where the working tree is with --work-tree
. How do I tell Git where the gitignore file is?
Q. Why would I want to do such a thing?
A. For some working trees I have two different Git repositories. One is in the standard location of .git
. This repository I use for normal version control. The other respository is in .git.sync
. This repository I use for periodic automatic syncing between computers. I.e., it's my own little Dropbox clone implemented with Git and a little script that runs periodically.
Ideally, I would be able to tell Git to use .gitignore.sync
for the .git.sync
repository, rather than having Git use the very same .gitignore
that it uses for normal version control.
Q. Why don't I just use Dropbox?
A. It doesn't sync symlinks. Bad Dropbox!