Ok, in TFS we have a main trunk branch and another branch, let's call it secondary. We have created a new file in the trunk but when trying to merge that specific file, it does not give us the option to merge to the secondary branch. We're assuming that it's because an analagous file does not exist in secondary.
Is this the cause of the problem and if so, how can we get that new file from the trunk into secondary?
Here, we are merging a file that does exist in secondary. As you can see, the dropdown lists all three of our branches (secondary is actually the middle one):
Now, when I try to merge a file which was created in trunk after secondary was branched, secondary is no longer listed as a target branch.
Right-click the main branch, point to Branching and Merging, and then click Merge… The Source Control Merge Wizard appears. On the Select the source and target branches for the merge operation screen: In Source branch, specify the main branch. In Target branch, specify the development branch.
trying to merge that specific file
To understand TFS it helps to remember that the unit of change is the changeset, and it is changesets (not files) that are checked-in and merged.
We're assuming that it's because an analagous file does not exist in secondary
This is correct - at the version (changeset number) that the target branch is at, this file simply does not exist, so there is nothing to merge to.
In general, you don't gain anything by selecting a particular file in the merge source dialog - as it says, it asks you to select the source and targe branches. Specify the branches at their root, choose Selected changesets only
, and TFS will show you a list of changesets that exist in source but have not been merged to target. If you only want the one that added this new file, you can select it in that list.
I think this should be possible over the VS GUI as follows:
Select the folder where the new file was added and order a merge (of the whole folder) to your secondary branch.
Now all changed files of the folder appear in your pending list + your new file.
Undo all other files & proceed with checking in only the one file that matters.
One could argue that this restriction of TFS in fact makes sense:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With