0
votes

I'm using TFS 2010. I have 2 changesets in child branch that I do not want to merge in the parent branch.

e.g

  1. (1002) Rolled back changeset
  2. (1001) Changeset checked in by mistake

I don't want these changesets from appearing in the merge menu when you attempt to merge into the parent branch.

If I have understood correctly that I can use the following TFS command to ignore these 2 particular changesets or will the rollback changeset interfere?

tf merge childbranch parentbranch  /r /version:1001~1002 /discard
1

1 Answers

1
votes

You can do a discard merge. This has to be done from the command line. Open up the Developer command prompt, then navigate to a folder under either of your branches (i.e. navigate to one of the affected workspaces). Then type:

tf merge /r /discard "$/Project/B1" "$/Project/B2" /v:C12345~C12345

This will take the changeset identified (in this case it was changeset #12345), and update it as merged to the target branch (branch B2). The target files will be checked out, but they will not be changed - you can simply check them in to complete the operation. After that the changeset will no longer appear as a merge candidate. You can specify a range of changesets to merge at the same time, but they should be contiguous.

Note that after doing this a changeset will occasionally still show up as a merge candidate - this is rather uncommon with the latest versions of TFS, and it is virtually impossible to fix (unless you are running your own local install of TFS and want to get your hands very dirty in the database). If you end up with one of these marooned changesets, just ignore it.

Source: Finding merge candidates in TFS

Note: When the command has finished, you still need to check in the merge.

For more tutorials, you could also refer below blogs: