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

Sha*_*ger 5 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.

sch*_*tbi 1

我建议有一个设置文件夹,并在其下面为每个用户创建一个文件夹。如果您有一个不错的操作系统,那么会有一个包含登录用户名称的环境变量。

您的目录结构将是:

Project
 / Settings
   / User1
   / User2
   / User3
Run Code Online (Sandbox Code Playgroud)

现在一切都已签入,每个用户都有其目录。下一步是在构建脚本、项目文件和脚本或使用环境变量的任何内容中使用用户特定部分。