Handling conflicts in SVN with Tortoise?

2019-03-25 00:25发布

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).

5条回答
甜甜的少女心
2楼-- · 2019-03-25 01:06

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
查看更多
我想做一个坏孩纸
3楼-- · 2019-03-25 01:08

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

查看更多
狗以群分
4楼-- · 2019-03-25 01:10

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

查看更多
我只想做你的唯一
5楼-- · 2019-03-25 01: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!

查看更多
SAY GOODBYE
6楼-- · 2019-03-25 01:28

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.

查看更多
登录 后发表回答