Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

svn ignore a file but include it in checkout

Tags:

svn

I have a project in a repository. People will soon start checking it out, working on it, then committing their changes back. But there is one file within that project (an elaborate configuration file of my own design) that everyone simply must have a copy of, but they will make changes to it that should never ever be checked back in (that is never should they be sent via update back to the repository).

So, I want each user who checks out the project to receive this config file, but then I want it ignored on all commits.

What I've read so far makes me feel this is not going to be possible. It seems that once I've imported the project with this config file it is under version control and there is no way anymore to ignore it other than removing it.

I hope I just misunderstood and the solution is an easy one.

Can anyone help?

Oh, I need a command line solution please if possible. A lot of the work is done on headless linux boxes with ssh-only connections.

Thanks!

EDIT: I went with cdhowie's answer. In addition to creating a template config file (for example app.config.template) as he suggests, I also use the "svn propedit svn:ignore" to have the real config file name (for example app.config) ignored on commits.

like image 838
John Fitzpatrick Avatar asked Nov 09 '10 23:11

John Fitzpatrick


People also ask

How do I ignore a file in svn?

The svn:ignore property One of these properties is svn:ignore . How this works is that you use the command svn propset to set the property svn:ignore on a particular directory. You give svn:ignore a value, which is a file name pattern. Then, svn will ignore all items in this directory whose name matches the pattern.

How do I move files in svn without losing history?

If you right-drag the folder and use "SVN move versioned item(s) here", then you keep the history.

How do I ignore bin and obj folder in svn?

If you right click on a single unversioned file, and select the command TortoiseSVN → Add to Ignore List from the context menu, a submenu appears allowing you to select just that file, or all files with the same extension.


1 Answers

Usually the way you do this is by providing a template file that the user or a script will copy to where it belongs. That file will then be ignored.

For example, say you have app.config as the config file. You would commit yours as app.config.template or something similar. Users would have to copy and rename the file to begin development. app.config would be ignored in SVN.

This doesn't work cleanly for updates, but it's about the best you can get. Another option would be to set access restrictions in the repository so that app.config cannot be changed by anyone else.

EDIT: I said that this doesn't work cleanly for updates, but on second thought, if the developers are changing this file a lot anyway, they probably don't want updates from you clobbering their own settings. Using a template file will actually be easier on your developers, since they can pick which changes to merge in themselves.

like image 90
cdhowie Avatar answered Oct 30 '22 06:10

cdhowie