My use case starts from something a lot like this; a team uses a central repository (in my case it is subversion, but I believe if it were git the issue would be the same), and some of the files are member-private (Django local settings files, IDE private project preferences etc). While the private file should remain private -- that is, I don't want changes I make to it to be pushed or dcommitted -- I do want the file tracked and version controlled.
The best option would be a way to keep the file private by default; a workaround would be a way to keep private commits -- having to remember to commit the private file separately would be a nuisance, but still better than not being able to track it at all.
In comparison to suggested solutions: this and this aren't good because they prevent the file from being committed at all; this is not what I want. I want it committed locally; I just don't want it published.
BTW -- while I love DVCSs, and git has been a sort-of default, I don't feel particularly committed to it (pun unintended); if only hg or bzr can do this, it may be reason enough for me to switch.
the way I have managed this, and I don't know if this would be agreeable in your situation, is to create a template file, eg settings.txt.template
which resided in the committed repo. and then setup your personal file locally (settings.txt added to the .gitignore file).
Otherwise you might look at git submodules http://book.git-scm.com/5_submodules.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With