Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell git (or some other dvcs) to track a file privately?

Tags:

git

dvcs

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.

like image 915
Shai Berger Avatar asked Aug 18 '10 18:08

Shai Berger


1 Answers

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

like image 186
Jed Schneider Avatar answered Oct 01 '22 03:10

Jed Schneider