开发者

Half-ignored files in VCS - is this supported?

开发者 https://www.devze.com 2023-01-19 10:15 出处:网络
I am using Eclipse and Subversion for Java development, and I find myself wishing for a feature in version control systems (one that is not available in SVN, to the best of my knowledge).

I am using Eclipse and Subversion for Java development, and I find myself wishing for a feature in version control systems (one that is not available in SVN, to the best of my knowledge).

I would like my project settings files to be half-ignored. To be more precise, I want them to be available in VCS, I want merge to occur when someone checks in changes, but. I want my own changes ignored unless I very explicitly tell the system to take them.

This would allow me to have my local paths (and other settings) in my local configuration w/o screwing up other people's configuration. But, when I have a substantial change, I can still check it in (very very carefully, may be temporarily removing my other local changes) and have it delivered to other people.

Now, the actual ques开发者_StackOverflowtion: is there any VCS that supports this feature? Or may be I am missing something in SVN? How do other people solve this problem in Eclipse?


Yes, Git support that feature through filter driver (a clean script can run upon commit, allowing you to clean the content from any of your changes if you want).

Half-ignored files in VCS - is this supported?

But another way would be to never version that setting file, and only version:

  • a template file
  • a value file
  • a script able to replace variables in the template files with the values from the value file, in order to generate the actual (and "private", as in "not versioned") setting file.

That way, you can modifying it at your heart's content without ever committing your changes.


.gitignore for git, .hgignore for mercurial and file paths and patterns can be added that will not be committed. There similar in SVN but i never worked out how to use it myself but my sysop did set it up form me.


git supports this with

git update-index --assume-unchanged <file>

and the complementary

git update-index --no-assume-unchanged <file>

See http://blog.pagebakers.nl/2009/01/29/git-ignoring-changes-in-tracked-files and http://kernel.org/pub/software/scm/git/docs/git-update-index.html#_options for more details.

0

精彩评论

暂无评论...
验证码 换一张
取 消