Niels Heidenreich
Niels Heidenreich

Reputation: 1287

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 moment, 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 :)

Upvotes: 5

Views: 2180

Answers (3)

seb
seb

Reputation: 4086

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.

Upvotes: 0

tato
tato

Reputation: 5549

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

Upvotes: 8

zerkms
zerkms

Reputation: 254886

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).

Upvotes: 0

Related Questions