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?
views:
218answers:
2Whenever 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)