4

I ran into a problem trying to merge from integration to feature branch.

The trouble started with these 3 actions: 1) Added project ABC to Solution1 in integration branch.
2) Branched Solution1 to feature branch. 3) Deleted project ABC from Solution1 in integration branch.

Now, I want to merge latest from integration to feature branch, but I don't want to actually delete project ABC during the merge.

My criteria are to resolve this using: a) a single check-in b) merging all change-sets (including the delete) since last merge c) no changes to the existing project names/paths

In my dreams, I request the merge, and before check-in add the deleted project back in from a copy I've saved, and edit the solution file to retain the reference data to the same project.

Anybody out there have any idea how to go about doing this, or perhaps know an insightful Microsoft reference to document why I can't or why that's a bad idea?

I'm using Team Foundation Server 2010 with Visual Studio 2010 for source control, my solution and projects are developed in BIDS 2008.

Thanks for any enlightenment.

JM Hicks
  • 1,282
  • 1
  • 11
  • 22

4 Answers4

4

The accepted answer is plain wrong, because the merge never gets finished this way. If you go this way you have just a partially finished merge and get asked everytime again.

The real problem is, that you don't have a conflict while merging. Therefore you have no options on the merge result!

So let's first undo your merge and redo it. But before you merge again provoke a conflict on every file by CheckingOut the whole target branch (or just the files you want to prevent from being deleted)! You can do this without editing the file. You can right click the file in Source Control Explorer and Select CheckOut.

Then you can resolve the conflicts and merge them without accepting the delete! :)

Felix Keil
  • 2,344
  • 1
  • 25
  • 27
2

Merge the integration branch to feature branch.

The merge operation simply "pends" all changes from the merge.

Review the pending changes and remove the deletes that you don't want.

Commit.

Dylan Smith
  • 22,069
  • 2
  • 47
  • 62
  • hmmm. Our normal work rules are to always go integration to feature before we go feature to integration. The project-deletion was by itself when checked-in originally. Now if I simply uncheck the deletes, (and edit the solution file), during the merge check-in, I'm afraid that the next merge from integration to feature will still bring up the same project-deletion again. Ok, I will try this anyway when I get a chance and all votes/checks/other-such-goodies will be updated accordingly. Thanks. – JM Hicks Dec 05 '12 at 10:10
  • 2
    Read the original question wrong, updated my answer to say merge from integration to feature. My advice still stands. It should record which changesets were merged, even if you uncheck the deletes. – Dylan Smith Dec 05 '12 at 17:05
  • I created two test branches Tb1, and branch from Tb1 to Tb2. I deleted the project ABC from the solution in Tb1, checked-in. Merged latest from Tb1 to Tb2. Edited the solution file in Tb2 to add back the project info that would otherwise be deleted, unchecked the deletes of project ABC's folders/files, checked-in. TFS Track change-set showed that the delete change-set from Tb1 had indeed been committed (it used the Content descriptor partially, but ok) to Tb2. As a side note there were no conflicts for me to resolve when later I merged latest from Tb2 to Tb1. That does it. Thank you ! – JM Hicks Dec 07 '12 at 10:46
  • 1
    When I did this, the next merge wanted to delete those files again (as the delete-operation hadn't been merged again). So I had to do the merge, check in the deletes, then re-add the deleted files. Quite cumbersome... – Peter Mar 01 '13 at 14:13
1

I would see options to do this, but one has a precondition: 1. Do a cherry picking merge from general to feature branch. This means you choose all changesets, except the one where the project was deleted. But it is necessary that this changeset does not contain any other changes than deleting the project. 2. Do the merge, if you get merge conflicts with the files of the project, take the target to be master. If no conflicts occurs, undo the merge changes (merge, deletion) on the project in the feature branch. Doing this will mean that all changes were merged, except changes for the specific project.

MikeR
  • 3,045
  • 25
  • 32
  • Thanks, that seems like it would be a practical approach for myself or someone in a similar situation to follow. I would prefer to include all change-sets however if possible. I just added that into the description to make that more clear. – JM Hicks Dec 04 '12 at 10:49
0

The top-voted answer is close and would work, but it distorts history by marking the file edited when it really isn’t edited. The correct thing to do here is to perform a discard merge on the impacted itemspec, see the merge command.

Example:

tf merge /recursive /discard $/SourceProject/path/to/abc .\path\to\abc