rmcc
rmcc

Reputation: 3567

Committing single change in SVN

Is it possible to commit a single change to SVN without committing any of the other changes in the file?

For example, I have a file, config.properties, source controlled under SVN, and my local copy of this file contains numerous changes that are only relevant to my local environment. However, I want to commit a new config entry to this file so that my team mates can pick this up, but I don't want to lose my local changes.

Is there any way to do this?

Upvotes: 2

Views: 218

Answers (4)

Chris Bloom
Chris Bloom

Reputation: 3554

In your specific case, I second silentghost's suggestion. I never keep live copies of my config files in the repo, only template files. This has other benefits: You will never accidentally overwrite your production config files on update, you can keep sensitive info like database passwords out of the repository, and everyone can have their own development setup that suits their needs/preferences. When a new config line is required, just check it into the template and notify the other developers they need to merge it with their local copies. (Or, maybe look at abstracting the config file into one that changes with each environment (db connection, etc.) and one that doesn't change (constants, language vars, etc.) and that can be part of the repo.

That said, for the general need to merge a single line change into the repo, Orbman and jeffamaphone are correct. (Orbman would get my vote for most comprehensive answer, but I had already voted for SilentGhost.)

Upvotes: 0

D'Arcy Rittich
D'Arcy Rittich

Reputation: 171351

It's not possible easily. But, the workaround is:

  • copy your modified config.properties somewhere safe outside of your working folder
  • revert config.properties
  • apply only the change you want to commit to config.properties
  • commit config.properties
  • copy your backup (safe copy) over config.properties in your working folder to get your changes back that you did not want to commit

Upvotes: 2

SilentGhost
SilentGhost

Reputation: 319511

I'd suggest having a template config under the svn and having a local config ignored. This way you'd be able to do what you want: update template, merge with with local config and you're good to go.

Upvotes: 4

i_am_jorf
i_am_jorf

Reputation: 54600

No, this isn't possible. Just svn checkout that file in a separate location and make the change their and merge it back into your other changes.

Upvotes: 3

Related Questions