开发者

Subversion: How to make local changes to a file *never* check in, but have it sync with remote anyway?

I have a file with local changes that should never sync back to the repository because it's for my local installation only. But if that same file is changed in the repo, I want those changes to update my local copy, anyway.

At the m开发者_开发问答oment, the file in question always shows up in the list of changes when I want to check-in my changes, and I have to manually exclude it from the check-in. How do I make it so that I can just update, with the above restriction in place?

Thanks :)


If you are using TortoiseSVN you can add that file to the 'ignore-on-commit' changelist.

This is different to svn:ignore. The file will be versioned (i.e. it will exist in the repository), you will get updates to it when updating but, when you commit, this file will show up in a separate list and unchecked by default. You can still commit the file but it is much more difficult to accidentally commit it.

I use this feature for database config files that need to be locally modified but not commited.

See documentation here: (search for ignore-on-commit) http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-changelists.html http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-commit.html


You can create a pre-commit hook, that checks that file is committed and aborts commit if so.

http://wordaligned.org/articles/a-subversion-pre-commit-hook

Here you can see the sample of such hook (which checks if there are tabs in the commited files. All you need to do - is to write the similar script that checks if there is that file in the list of changed files).


This isn't straightforward. There are two pretty much identical questions elsewhere with some good answers.

You could also consider writing a shell script that creates a patch against your version using svn diff; moves your version away; does an svn up; and patches the new, updated version.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜