Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there some way to commit a file "partially" in TortoiseSVN?

I'd like to commit just a part of a file using TortoiseSVN, is there some way to do that?

I'll give an example to make it clearer why I want to do that.

I have a file with some defines that are replaced in the build process, something like this:

#define SOME_PATH "[SOME_PATH]" 

This [SOME_PATH] tag is replaced in the build process but when I'm coding I have to change it so the actual path in my machine.

So each time I commit I need to backup some lines, revert them, commit and then restore the backup, and this is kinda annoying.

Is there some way to tell TortoiseSVN to "ignore" some changes in, say, Lines X,Y and Z?

like image 844
Fabio Gomes Avatar asked Nov 24 '08 13:11

Fabio Gomes


People also ask

How do you commit in TortoiseSVN?

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. If you don't want a changed file to be committed, just uncheck that file.

What does red exclamation mark mean in TortoiseSVN?

That means the Subversion status is normal. As soon as you start editing a file, the status changes to modified and the icon overlay then changes to a red exclamation mark. That way you can easily see which files were changed since you last updated your working copy and need to be committed.

How do I edit a TortoiseSVN file?

Click on the new working copy and right click to select the repository browser (TortoiseSVN -> Repo-browser) Right click the file of choice in the repository browser and select "Update item to revision"


1 Answers

The top voted answer is out-of-date.

From the tortoiseSVN website: http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-dug-commit.html

Commit only parts of files

Sometimes you want to only commit parts of the changes you made to a file. Such a situation usually happens when you're working on something but then an urgent fix needs to be committed, and that fix happens to be in the same file you're working on.

right click on the file and use Context Menu → Restore after commit. This will create a copy of the file as it is. Then you can edit the file, e.g. in TortoiseMerge and undo all the changes you don't want to commit. After saving those changes you can commit the file.

After the commit is done, the copy of the file is restored automatically, and you have the file with all your modifications that were not committed back.

like image 168
Greylander Avatar answered Sep 20 '22 11:09

Greylander