Merging changes in TFS through Visual Studio may fail if the branch you are merging from has been renamed, or moved under or out of a folder, with the following error:

No matching items found in $/[Project] at the specified version

Reproducing

  • Branch "Main" to "v1"
  • Check in a change to the "v1" branch
  • Rename the branch to "v2", (or change the path in any way, like putting it under a folder)
  • Try to merge the changeset you checked into "v1" back into the "Main" branch.

Result You will get an error similar to “No matching items found in $/[Project]/v2 at the specified version”

Fix In order to overcome this, you need to specify the old path for the merge, which you are unable to do through the UI in Visual Studio. To do this, open up the visual studio command prompt and run the following:

tf merge "$/[Project]/v1" "$/[Project]/Main" /recursive /version:C[ChangesetNumber]

Be sure to change [Project] to whatever your team project name is, and [ChangesetNumber] to whatever changeset you are merging from the branch into the main branch; or some other version specifier if you aren’t merging from a changeset number.

See the documentation on merging on msdn for further information.