<p>Given the case I made <strong>two independent changes</strong> in <em>one</em> file: eg. added a new method and changed another method.</p>

<p>I often don't want to commit both changes as <strong>one</strong> commit, but as <strong>two</strong> independent commits.</p>

<p>On a git repository I would use the <strong>Interactive Mode</strong> of <a href="http://linux.die.net/man/1/git-add" rel="noreferrer">git-add(1)</a> to split the <em>hunk</em> into smaller ones:</p>

<pre><code> git add --patch
</code></pre>

<p>What's the easiest way to do this with Subversion? (Maybe even using an Eclipse plug-in)</p>

<p><strong>Update:</strong><br/>
In <a href="http://tomayko.com/writings/the-thing-about-git" rel="noreferrer">The Thing About Git</a>, Ryan calls it: <em>“The Tangled Working Copy Problem.”</em></p>

[{'answer_id': 75881, 'author': 'Greg Hewgill', 'author_id': 893, 'author_profile': 'https://Stackoverflow.com/users/893', 'pm_score': 3, 'selected': False, 'text': '<p>I used to do this:</p>\n\n<ul>\n<li>In my editor (I use vim), edit the file so that only one of the changes appear</li>\n<li>Save the file (but don\'t quit the editor)</li>\n<li>Commit the changed file to svn</li>\n<li>Hit "undo" in the editor enough times for the second set of changes reappear</li>\n<li>Save the file again</li>\n<li>Commit the second set of changes.</li>\n</ul>\n\n<p>This is a simplistic approach that assumes one set of changes is reasonably easy to undo. For more complex situations, I would give up and commit both changes without worrying about it.</p>\n\n<p>Now that I use git, this is something I hope I\'ll never have to do again!</p>\n'}, {'answer_id': 75901, 'author': 'Spike', 'author_id': 13111, 'author_profile': 'https://Stackoverflow.com/users/13111', 'pm_score': 5, 'selected': False, 'text': '<p>I have done this using <a href="http://tortoisesvn.tigris.org/" rel="noreferrer" title="TortoiseSVN">TortoiseSVN</a>.</p>\n\n<p>The built in merge utility allows you to show a diff between the repository version and your working copy.</p>\n\n<p>Use the <em>create backup</em> function of the diff utility</p>\n\n<ol>\n<li>Go to commit your file as if you were going to commit all your changes.</li>\n<li>In the commit window, double click the file to show a diff.</li>\n<li>In the diff settings, click the option to <em>backup original file</em>. </li>\n<li>Right-click the changes you don\'t want, and use select <em>use other text block</em>.</li>\n<li>Save the diff <strong>exactly once</strong>. The backup will be overwritten each time you save. This is why you only want to save once.</li>\n<li>Commit the change.</li>\n<li>Overwrite the original with the created .bak file (which will have all your original changes).</li>\n<li>Commit your file.</li>\n</ol>\n\n<p>You should now have all your changes committed, using two separate commits.</p>\n'}, {'answer_id': 75918, 'author': 'Aeon', 'author_id': 13289, 'author_profile': 'https://Stackoverflow.com/users/13289', 'pm_score': 2, 'selected': False, 'text': '<p>I use either a local darcs repo, or just merge the changes in gradually. With merging (opendiff opens FileMerge, a merge program that comes with Xcode; replace with your favorite merge tool):</p>\n\n<pre><code>cp file file.new\nsvn revert file\nopendiff file.new file -merge file\n</code></pre>\n\n<p>merge the related changes, save the merge, quit the merge program</p>\n\n<pre><code>svn ci -m \'first hunk\' file\nmv file.new file\nsvn ci -m \'second hunk\' file\n</code></pre>\n\n<p>if more than one unrelated hunk in the file, rinse and repeat (but why would you wait so long before committing?!)</p>\n\n<p>Also, if you know git, you can use <a href="http://git.or.cz/course/svn.html" rel="noreferrer">git-svn</a> to maintain a local git repo and sync your commits to an svn master server; works great in my limited experience.</p>\n'}, {'answer_id': 75950, 'author': 'Chris', 'author_id': 13488, 'author_profile': 'https://Stackoverflow.com/users/13488', 'pm_score': 5, 'selected': False, 'text': "<p>Try using <code>svn diff &gt; out.patch</code> then copy the <code>out.patch</code> file to <code>out.patch.add</code> and <code>out.patch.modify</code>  </p>\n\n<p><em>Only when you have a working patch file</em> revert the original file using <code>svn revert out.c</code>.</p>\n\n<p>Edit the patch files by hand so that they only contain the <em>hunks</em> for adding or modifying.  Apply them to the original file using the <code>patch</code> command, test if the addition worked, then <code>svn commit</code> the addition.</p>\n\n<p>Wash rinse repeat for the <code>out.patch.modify</code> patch.</p>\n\n<p>If the changes are separate in the file as your initial question stated - added a new method, changed an existing method - this will work</p>\n\n<p>This is a very tedious solution - although I'm not convinced you should have any reason to separate your commits.</p>\n\n<p>You also could have checked out multiple working copies of the same source to apply your work against:</p>\n\n<blockquote>\n  <p><code>svn co http://location/repository methodAdd</code></p>\n  \n  <p><code>svn co http://location/repository methodModify</code></p>\n</blockquote>\n\n<p>Be sure to <code>svn up</code> and test to make sure all is well.</p>\n"}, {'answer_id': 76088, 'author': 'jkramer', 'author_id': 12523, 'author_profile': 'https://Stackoverflow.com/users/12523', 'pm_score': 6, 'selected': True, 'text': '<p>With git-svn you can make a local GIT repository of the remote SVN repository, work with it using the full GIT feature set (including partial commits) and then push it all back to the SVN repository.</p>\n\n<p><a href="http://schacon.github.com/git/git-svn.html" rel="noreferrer">git-svn (1)</a></p>\n'}, {'answer_id': 462321, 'author': 'BCS', 'author_id': 1343, 'author_profile': 'https://Stackoverflow.com/users/1343', 'pm_score': 2, 'selected': False, 'text': "<ol>\n<li>Open all the files you want to split in editor-of-choice</li>\n<li>Using a different tool set (on Win, use Spike's suggestion (the old version)) back out the second set</li>\n<li>Commit</li>\n<li>go back to your editor-of-choice and save all the files</li>\n</ol>\n\n<p>It's a little riskier than Spike's full suggestion but can be easier to do. Also make sure you try it on something else first as some editors will refuse to save over a file that has changed out from under them unless you reload that file (losing all your changes)</p>\n"}, {'answer_id': 17538550, 'author': 'Casebash', 'author_id': 165495, 'author_profile': 'https://Stackoverflow.com/users/165495', 'pm_score': 6, 'selected': False, 'text': '<p>Tortoise SVN 1.8 <a href="https://tortoisesvn.net/tsvn_1.8_releasenotes.html#commitparts" rel="noreferrer">now supports</a> this with it\'s "Restore after commit" feature. This allow you to make edits to a file, with all of the edits being undone after the commit</p>\n\n<p><strong>Per the documentation:</strong></p>\n\n<blockquote>\n  <p>To commit only the parts of the file that relate to one specific issue:</p>\n  \n  <ol>\n  <li>in the commit dialog, right-click on file, choose "restore after commit"</li>\n  <li>edit the file in e.g. TortoiseMerge: undo the changes that you don\'t want to commit yet</li>\n  <li>save the file</li>\n  <li>commit the file</li>\n  </ol>\n</blockquote>\n'}, {'answer_id': 19255703, 'author': 'parvus', 'author_id': 911550, 'author_profile': 'https://Stackoverflow.com/users/911550', 'pm_score': 4, 'selected': False, 'text': '<p>This is possible using TortoiseSvn (Windows) since v1.8.</p>\n<blockquote>\n<p>4.4.1. The Commit Dialog</p>\n<p>If your working copy is up to date and there are no conflicts, you are ready to commit your changes. Select any\nfile and/or folders you want to commit, then TortoiseSVN → Commit....</p>\n<p>&lt;snip&gt;</p>\n<p>4.4.3. Commit only parts of files</p>\n<p>Sometimes you want to only commit parts of the changes you made to a file. Such a situation usually\nhappens when you\'re working on something but then an urgent fix needs\nto be committed, and that fix happens to be in the same file you\'re\nworking on.</p>\n<p>right click on the file and use Context Menu → Restore after commit.\nThis will create a copy of the file as it is. Then you can edit the\nfile, e.g. in TortoiseMerge and undo all the changes you don\'t want to\ncommit. After saving those changes you can commit the file.</p>\n<p>After the commit is done, the copy of the file is restored\nautomatically, and you have the file with all your modifications that\nwere not committed back.</p>\n</blockquote>\n<p>On Linux, I would give <a href="http://webstaff.itn.liu.se/%7Ekarlu20/div/blog/2013-05-31_SVNPartialCommit.php" rel="noreferrer">http://webstaff.itn.liu.se/~karlu20/div/blog/2013-05-31_SVNPartialCommit.php</a> a try. Haven\'t tried it out myself, though.</p>\n'}, {'answer_id': 35370831, 'author': 'Ian Dunn', 'author_id': 450127, 'author_profile': 'https://Stackoverflow.com/users/450127', 'pm_score': 0, 'selected': False, 'text': "<p>I think an easier option than generating diff files, reverting, etc, would be to have two copies of the repository checked out, and use a visual diff tool like DeltaWalker to copy hunks from one to the other.</p>\n\n<p>The first copy would be the one you actually work off of, and the second would just be for this purpose. Once you've made a ton of changes to the first, you can copy one section over to the second, commit it, copy another section, commit it, etc.</p>\n"}, {'answer_id': 46731868, 'author': 'michaeljt', 'author_id': 213180, 'author_profile': 'https://Stackoverflow.com/users/213180', 'pm_score': 0, 'selected': False, 'text': '<ol>\n<li>Copy all modified files concerned to back-up copies.</li>\n<li>Create a patch of the working state using <code>svn diff</code>.</li>\n<li>Revert the files using <code>svn revert</code>.</li>\n<li>Re-apply the parts of the patch which you wish to commit, either using the <code>patch</code> tool, or by manual editing, or whatever.</li>\n<li>Run <code>diff</code> afterwards to compare your working copy with your back-up to be sure you applied the patch-parts correctly.</li>\n<li>Build and test.</li>\n<li>Commit.</li>\n<li>Copy your back-up copies back to your repository check-out.</li>\n<li>Repeat at 2. (not at 1.!) until done.</li>\n</ol>\n'}, {'answer_id': 49452436, 'author': 'bahrep', 'author_id': 761095, 'author_profile': 'https://Stackoverflow.com/users/761095', 'pm_score': 2, 'selected': False, 'text': '<p>Try <a href="https://www.visualsvn.com/visualsvn/" rel="nofollow noreferrer">VisualSVN for Visual Studio</a>. The <a href="https://www.visualsvn.com/company/news/visualsvn-6.1" rel="nofollow noreferrer">latest 6.1 release</a> introduces the QuickCommit feature. You can partially commit selected changes in a file using the new <strong>Commit this Block</strong> and <strong>Commit Selection</strong> context menu commands in the Visual Studio editor.</p>\n\n<p><a href="https://i.stack.imgur.com/hV92h.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hV92h.gif" alt="enter image description here"></a></p>\n'}]
['https://Stackoverflow.com/questions/75809', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4308/']