views:

218

answers:

2

I'd like to disable the automatic merge feature when checking in a file to TFS that another developer has worked on so that I always need to merge manually. Is there any way to do this?

+1  A: 

Whenever two people have changed the same file, you have to "merge" the code. This can take three forms:

  • Keep your version (discarding their changes)
  • Keep their version (discarding your changes)
  • Merge both changes to blend them both together

You can't "turn this off", because there is no other safe way to resolve the clash.

The closest you can get to turning merging off is to disallow multiple checkouts (lock the file so that only one developer can work on it at a time). This prevents two concurrent edits occurring, and thus avoids the problem of merging entirely. (At the extra cost of developers often being blocked and unable to work on a file while another developer has the lock). This is an awful and usually inefficient way to work - I wouldn't recommend it.

You can minimise the need for merges:

  • Check in frequently. Many small changes reduces your exposure to merge conflicts, while a few large changes increase your exposure.
  • Split large and often-changed files up into many smaller files to minimise the chance that 2 developers need to chnage the same file at the same time
  • Before you start working on a file, check if anyone else is editing it, and try to reorganise your "schedule" so that you don't have to start editing that file while the other programmer is working on it (a self-imposed "soft lock", to just reduce the chance of merges being necessary)

You can also upgrade the merge tools. Visual Studio's merge is horrible, difficult to use, and often introduces problems into the code. It has bitten me so many times I cannot ever trust it, so have to do painful manual merges every time. I now use Araxis Merge which always does an automatic merge perfectly, giving me confidence that I can just leave it to do the merge for me. (I've never used another merge program that gives me that confidence, and I've tried pretty much every other option over the years). When a manual merge is required, it offers a very clear merge view to "read", and very quick and intuitive UI for choosing how to merge each bit of code, making it very efficient. I once struggled for 3 days with a complex merge in VS (corrupting the code several times until I gave up) then I bought Araxis Merge and re-did the entire merge perfectly in 15 minutes. A good tool really takes the pain out of merging.

(I am not affiliated with Araxis in any way, I just can't stand most of the terrible merge tools out there)

Jason Williams
I don't want to take away the merge capability. I just want to turn off the automatic merge "feature" because it tends to do so terribly. Basically I want it so I will always do a manual merge.
Bryan Anderson
I already have it set up to do manual merges in Winmerge which makes manual merges nearly painless.
Bryan Anderson
Ah. In that case, apologies for not being very helpful. I'm afraid I share your complaint (the number of dialogs you have to work through to round-trip the merge between VSTS and the merge tool is so frustrating, tedious and time-wasting! As soon as I get some free time, I think I'll just write a replacement front-end for TFS, 'cos the MS one (to use the technical term) truly sucks)
Jason Williams
No worries, I wasn't very clear in my question. I've edited it to hopefully be more clear.
Bryan Anderson
+1 for a great answer anyway. I'm sure someone will come to this question that really just needs a good explanation of merging and your answer will be a huge help. Also for future reference, here's how you set up VS to use a different diff/merge tool than the one built into VS: http://blogs.msdn.com/jmanning/articles/535573.aspx
Bryan Anderson
A: 

The short answer as of Visual Studio 2008 seems to be no.

Bryan Anderson