Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SVN - commit only some changes

Tags:

svn

One of the things I like about GIT is that you can commit only some changes in a file. For example if you were doing two different changes which involved the same file, you can commit the file as two separate commits with different comments.

Like:

I spent all day working on a file before realizing that the previous days changes had not been commits, I can do the following by selecting which lines I would like to include in the commit:

Login.php [246]: previous changes
Login.php [247]: new changes

I realise that this ability is because the changeset in GIT is a DIFF, while SVN simply commits an entire file. Is it possible to have the same behavior with SVN?

If there is a SmartSVN specific hack then that would be alright since that is what we use.

like image 868
Nippysaurus Avatar asked May 16 '11 01:05

Nippysaurus


People also ask

How do I commit a specific file in svn?

If your working copy is up to date and there are no conflicts, you are ready to commit your changes. Select any file and/or folders you want to commit, then TortoiseSVN → Commit.... The commit dialog will show you every changed file, including added, deleted and unversioned files.

How do I commit properties in svn?

In order to commit only the explicit paths specified on the command line use the --depth empty option e.g. in the directory with the newly modified externals property: $svn commit --depth empty . -m "Modify svn externals definition only."

What is difference between commit and update in svn?

Commit uploads your changes on the CVS / SVN server, and Update overwrites the files on your localhost with the ones on the server.


1 Answers

Use git-svn, I don't think SVN has this support, or rather any of the SVN clients do apart from git-svn or even hgsubversion


Some rant:

I don't think the reason you ask for this is a proper one. It means you have to change the way you create changesets and commit. The reason I would want such a feature is for the following reason:

Say there is a build file. It has a certain set of tasks to be done in the build server. For my local box, I comment out the part where it generates installers because I don't need to do that on dev box. Now if at sometime I want to make a change in this build file, I have to undo the part where I removed the installer generation and commit my other change. In this case, I would have liked to have the ability to choose the other change and commit that alone.

like image 113
manojlds Avatar answered Nov 15 '22 17:11

manojlds