MohamedG's Log


How to: Use tf merge /discard?

In a previous post, I mentioned some details about merge history bookkeeping. In a nutshell, when you merge, you are giving credit to the target branch for the range of versions you’re merging over. That’s why you see the merge change type pended on the target items, because it means that this will be recorded in the bookkeeping system, or merge history, when you commit this change so that you don’t re-merge the same versions/changes next time. However, sometimes you just need to record that merge in merge history without merging over the actual changes. This will give the target branch credit for these versions and discard porting the changes over. You guessed it right, that’s when you use tf merge with the /discard option then check in to commit the merge operation.

Note: If you use TFS 2008 SP1 and run tf merge /baseless /discard, there’s a known issue that was fixed here.