Pages

Wednesday, April 30, 2014

Discarding merge of a changeset in TFS

On a project I work on, we have just had the first branch of my life. The merge features in TFS helps me merge needed changes between the two branches and it works just perfect.

As part of the branch I have had to assign a particular range for label id's in one of the branches. This is to avoid conflicts when merging the label files. You set up the label id range from Version Control / System settings / General. Changing this, triggers a change to VCSDef.xml which is also under version in TFS.

This is obviously not a change that I'd ever want to merge. Fortunately there is a way to tell TFS to discard the change when suggesting what to merge. There is no UI for the command, so open a Visual Studio command prompt from the workspace folder to use and enter the following:

tf merge /discard /version:C1134 /recursive SourceBranchName TargetBranchName

This also triggers a change, so you must check that change in. And that's it. The changeset is not suggested for merge between these branches again.