Question

We have a couple of developers who are in favor of the manual merge in TFS 2010, it's when you open two visual studios, one with the source branch and another one with the target branch and you manually copy&paste your changes.

They do it this way because they believe an automatic merge is dangerous (as it bring in changes of other developers even if you did not want to). And the typical test case is following:

Source Branch:

TestFile.cs
Changesets:
1. Line 5 changed
2. Line 13 changed

Target Branch:

No changes yet.

Now I would like to merge only changeset #2 for the TestFile.cs

What lines would the resulting TestFile.cs in the target branch contain if merged automatically: the original line 5 and the changed line 13 or both lines 5 and 13 changed?

In fact I have seen both variants and I don't know why.

Any link to a great description of how exactly TFS merge works would be great to have.

Advanced scenario: Source Branch:

TestFile.cs
Changesets:
#1. Line 5 changed, Line 6 added
#2. Line 13 changed

Target Branch:

No changes yet.

If I only merge changeset #2 what should I get in the target branch? Will I only get the line 12 changed according to the changeset #2.

Was it helpful?

Solution

If you select to merge, the following dialog will open up:
enter image description here
If you simply select "Next" and preserve the default setting = "All changes up to a specific version", TFS will take into account both of your changesets (1 & 2): in other words it will check out Testfile.cs in the Target Branch and edit both Line 5 & 13.
If you select "Selected Changesets" (as marked in the picture above), another dialog will appear where you get to choose which of the candidate changesets you actually wish to participate in the merge. So, if you now select changeset 2, TFS will check out Testfile.cs in the Target branch & edit only Line 13.

What you describe as 'manual' merge, is - sorry for being verbose - a horrible practice.

Edit
On your question Advanced scenario: Source Branch: Will I only get the line 13 changed according to the changeset #2
The answer is a definite "Yes".

One way to isolate the situation is to start with a Playground-folder within SourceControl & try with your colleagues to identify what happens. TFS-merge is really straightforward, this older post might be useful for your investigations.

I can agree on you stand "TFS bugs are very low on my priority list", on the other hand - in your place - I would investigate as a top-priority issue the Merge-Practice within your organization. What you describe, in my opinion, simply cannot go on.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top