I have a settings file that is under version control using subversion. Everybody has their own copy of this file, and I need this not to be ever committed. However, like I said, there is already a copy under version control. My question is: how do I remove this file from version control without deleting everyone's file, then add it to the ignore list so it won't be committed? I'm using linux command line svn.
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
- How can I set the SVN password with Emacs 23.1 bui
After you delete the file, your users will have to recover the file from the repository using
svn export
.Where
x
is a revision where the file existed before it was deleted,path
is the full path to the file, and./
is where the file will be placed.See
svn help export
for more information.I have a similar issue. In my case it's an auto-generated user settings file (visual studio) that was accidentally checked in very early in the project. While just deleting it might work, it seems more
correct
to have it removed from the history, as it was never supposed to be in there in the first place.I came across this, which might be a new feature since this question was originally posted 7.5 years ago:
https://stackoverflow.com/a/6025750/779130
Seems like an idea would be to:
This might be the only way to completely get rid of the file. In most cases the "delete and ignore" approach might be good enough.
Make a clean checkout,
svn delete
the file and add the ignore. Then commit this. Everyone else will have to take care (once) that their local copy isn't deleted on the nextsvn update
, but after that, the local file would stay undisturbed and ignored by SVN.If you remove the file from version control, how does a developer new to the project (or the one who accidentally deleted his local copy) get it after initial checkout? What if there are additions to the settings file?
I would suggest the following: Keep a default settings file (with no passwords, hostnames, connection strings, etc.) in SVN, name it something like
settings.dist
, and let the code work with a copy of this, namedsettings
. Every developer has to make this copy once, and can then work with her personalized settings. If there are additions, add them tosettings.dist
– everyone else will get them with a update and can merge then into her personalized copy.simply define a file containing settings that will override the default ones. This file is not checked into Subversion and each developer is responsible for maintaining this file according to their environments.
In an Ant-based world, you would have the files:
and in your
build.xml
fileFor those who couldn't connect the dots:
init
target of your build, copy the settings.properties to settings-local.propertiesVoila, every developer has its own setting-local.properties and everything was done automatically (and no developer lost his or her settings, which happens if you brutally delete the file from Suvbersion and there is no "Everyone else will have to take care...")
[[ I'm new to subversion, so maybe this doesn't make sense. marking this as wiki -- if you know the right answer, please APPEND in the later section ]]
Couldn't you have a custom set of checkout steps so each user gets a different settings folder?
What I'm getting at is you want each user to have a custom view of the repository. In other version control systems, you could set up a custom listing of which projects you were using and which you weren't and which you put in odd places.
Does this work in subversion? The above code looks really risky, but maybe i'm doing it wrong.
WIKI:
(nothing yet)