Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Commit a partial file (Patch) to SVN [duplicate]

Tags:

commit

svn

patch

Possible Duplicate:
partial commits with subversion

Is there any way I can commit only some of the changes in a file to SVN? Let's say I'm working on 2 new features (or bug fixes), and they both affect the same file. I finish 1 feature, and I want to commit just one of the changes. I realize I could create a separate branch for each feature, but this makes things complicated in other ways, constantly switching back and forth between the several feature branches I may be working on at the same time.

Currently when I need to do this, I make a copy of the file, remove the changes I don't want to commit, and then commit that. Then I take the copy and put it back over the stuff I just committed, leaving only the changes I didn't want to commit. This is quite a lot of stuff to do just to possibly commit maybe 1 line for a small bug fix.

I know some might say, you shouldn't do this, because the whole point of committing a whole file is that you are aware exactly what you are committing, and that it won't break the code. But since you can commit individual files, this case isn't much different, because you can still forget to commit other files related to the files you are changing, and still cause the code to be broken. Or similarly forgetting to add files that the new feature depends on.

like image 832
Kibbee Avatar asked Mar 16 '11 14:03

Kibbee


1 Answers

Subversion does not have such feature and I don't believe there are plans to implement it in a near future. If it's an option, you can try other source control tools that have it:

  • http://www.paperplanes.de/2008/4/15/git_bits_committing_partial_file.html
  • Can I commit only parts of my code using SVN or Mercurial?
like image 145
Álvaro González Avatar answered Oct 06 '22 09:10

Álvaro González