5

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

Niels Heidenreich
  • 1,257
  • 1
  • 9
  • 20
  • This is a pretty common question with Subversion - see http://stackoverflow.com/questions/233441/svn-how-do-i-maintain-my-local-config-blah-file/233479#233479. – Avi Jan 05 '11 at 10:55
  • @Avi: even though it looks similar - it is not the same... – zerkms Jan 05 '11 at 10:58
  • Ok, I accept that it is different. It still seems to be a pretty common question, though, I can't find the exact duplicates at the moment. – Avi Jan 05 '11 at 11:27
  • Here are more duplicates: [How to deal best with SVN and local changes, that should not be committed?](http://stackoverflow.com/questions/4592678/how-to-deal-best-with-svn-and-local-changes-that-should-not-be-committed) and [Protect files from SVN commit](http://stackoverflow.com/questions/2779293/protect-files-from-svn-commit) and [Ignore SVN ignore… possible?](http://stackoverflow.com/questions/52398/ignore-svn-ignore-possible) etcetera. – Wim Coenen Jan 05 '11 at 14:20
  • @Neils: What Subversion client(s) are you using? – jgifford25 Jan 05 '11 at 14:34
  • does anyone have any way to do this using command line? – Scott Schulthess Apr 07 '11 at 21:12

3 Answers3

8

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

tato
  • 5,439
  • 4
  • 31
  • 27
  • I didn't see anything in the original post that Neils was using TortoiseSVN? – jgifford25 Jan 05 '11 at 14:33
  • @jgifford25: If = conditional. I believe the answer is useful, despite of being client specific. It is more useful that simply pointing at the svn:ignore property, that solves a slightly different problem. – tato Jan 16 '11 at 17:39
  • Good that solved my problem. I was looking for this feature for a long time. – abbas Jul 04 '13 at 16:42
  • This sounds helpful. Do you know how TortoiseSVN is storing and processing these rules itself or is it using a standard subversion feature and relying on the underlying subversion engine (such as tigris) to exclude files in the ignore-on-commit list? – IceArdor Nov 30 '15 at 07:53
0

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

zerkms
  • 249,484
  • 69
  • 436
  • 539
0

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.

Community
  • 1
  • 1
seb
  • 3,646
  • 26
  • 21