KingNestor
KingNestor

Reputation: 67960

Handling conflicts in SVN with Tortoise?

Any time an issue comes up like a merge conflict or something similar, it really slows me down.

Can someone explain to me how to force-resolve conflicts?

For example, a buddy of mine made an edit to a file on the repository and committed. While he was doing that, I had already renamed that file and made many edits to it on my working copy.

When I went to commit, I get the conflict error obviously. The file he edited doesn't even exist anymore on my working copy. How can I tell SVN to simply quit crying about the conflict and force it to accept my working copy (ie, overwrite the head revision with my working copy).

Upvotes: 14

Views: 40610

Answers (5)

himanshupareek66
himanshupareek66

Reputation: 846

Here, it is: If you're in two pane view, then you can only edit the file in the right pane (Mine). To apply changes made in the left file (Theirs), right click on the changed lines and select Context Menu → Use text block from 'theirs' . Then the changes from the left file are added to the right file.

Sometimes you actually want both text blocks, and the context menu also offers you Context Menu → Use both text blocks (this one first) and Context Menu → Use both text blocks (this one last).

If you're in three pane view (sometimes called merge view) you can only edit the file in the bottom view (Merged). As in two pane view, you can right click on conflicted lines and either select Context Menu → Use text block from 'theirs' or Context Menu → Use text block from 'mine' . In addition, if you want both blocks, you can select Context Menu → Use text block from 'mine' before 'theirs' or Context Menu → Use text block from 'theirs' before 'mine' . According to the command you've selected, the changes are used in the resulting Merged file.

Referenced link : https://tortoisesvn.net/docs/nightly/TortoiseMerge_en/tmerge-dug-conflicts.html

Upvotes: 0

trust_words
trust_words

Reputation: 11

I would say: The best way to prevent this from happening is to Update before you...MODIFY the file. Once you are done with your changes you will lose them if you update before you commit!

Upvotes: 1

bluebrother
bluebrother

Reputation: 8876

When you update your working copy you can right-click in the log list and chose how to resolve the conflict:

  • resolve using an editor / TortoiseMerge (or whatever merge tool you configured)
  • resolve using "theirs", i.e. the version in the repository
  • resolve using "mine", i.e. your version of the file.

This also works when deleting files properly -- i.e. you need to delete the file using svn if you want to actually delete it from the repository. If you removed the file for convenience reasons you might want to svn revert it before updating as a file missing from the working copy is a modified file too (unsurprisingly).

To sum it up: you can't tell svn to "stop crying" and simply overwrite with your working copy. This is a good thing. You need to resolve the conflict (which could mean simply overwriting the current state), mark the affected files as resolved (svn resolved) and then commit the result.

Upvotes: 10

KingNestor
KingNestor

Reputation: 67960

Here is how I did it:

  1. Right click on the Solutions folder, click TortoiseSVN -> Show Log.
  2. Right click the revision you want to revert, select "Revert Changes from this revision"
  3. Right click the conflicted folders, select "Resolved".
  4. Commit your solution
  5. Profit

Upvotes: 6

D3vtr0n
D3vtr0n

Reputation: 2909

The best way to prevent this from happening is to Update before you Commit.

Upvotes: 1

Related Questions