Adam Sills
Adam Sills

Reputation: 17062

TFS baseless merges - deleted and recreated target branch and baseless merge no longer works

I have the following branches on my source control, based on the following needs:
We have multiple environments, but in this case the important ones are Test and Production. We have multiple concurrent projects that need to be developed by separate teams and tested in a single test environment when they are ready. When they are ready, they can be pushed to production (with additional testing in an integration environment as warranted). We cannot organize features into dedicated releases - they need to go out as the business wants them to.

So what we settled on structure-wise was a branch-per-environment plus feature branches and we just accepted we would be performing baseless merges into the Test branch. Not a big deal as we can just merge specific changesets to Test via the UI.

$/Benefits/Source/Main - trunk where we do production and/or integration deployments
$/Benefits/Source/Test - branch where we merge features into for primary testing
$/Benefits/Source/Dev/LURE-7 - branched from trunk
$/Benefits/Source/Dev/[other features] - branched from trunk

I have a feature branch that was merged to Test successfully and tested. Unfortunately, the Test branch got severely messed up by a couple merges and we decided that simply deleting and recreating the Test branch would be the best approach. We deleted the Test branch and recreated it from Trunk.

I now need to re-merge my feature branch into Test and it would seem my feature branch is keeping a history of its baseless merges and thinks my changes are already in the target branch. I have verified that the specific file changes are not in there.

Essentially what's happening, when I select "specific changesets" in the first page of the Merge wizard, the next page doesn't show any changesets newer than the original branch.

The history of my feature branch, see the changes after the branch:
The history of my feature branch

Page 1 of the merge wizard:
Page 1 of the wizard

Page 2 of the wizard, it doesn't see the 2 changesets after the branch:
Page 2 of the wizard

The history of my Test branch, you can see it was deleted and recreated:
The history of my Test branch, you can see it was deleted and recreated
(6/27 I merged my feature branch, 7/5 I deleted and recreated the Test branch)

Upvotes: 1

Views: 667

Answers (1)

James Reed
James Reed

Reputation: 14052

When you delete a branch in TFS, it's really still there, just hidden. If you create a new branch with the same name / location then TFS will undelete the old branch.

The best approach is to either

  1. Create a new branch with a new name / location. Do this if you want to maintain history of the old deleted branch
  2. Use tf destroy from the command line. Use this if history isn't important. Be careful with this command. once it's gone the only way to get it back is from a backup of your TFS database.

Upvotes: 2

Related Questions