Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS - Cannot see Target branch when doing file Merge

We faced an issue with file Merge at TFS2010. Until now, we merged files from one branch to another without problems (right click at file -> Merge -> Choose Target branch and Merge files). Initially, we added new file at Develop branch, after that added same file at Main branch. After some period we had changes in code at Develop branch and when tried to do Merge with Main branch, cannot see Target (Main) branch. I have two questions regarding to this situation:

  1. Is this good way for 'uploading' new files at TFS. Separately add files at both branches or there is some better practice where we could add new file to Develop branch and after that make copy of that file at Main?

  2. What can be reason for 'hiding' Target branch during the Merge operation?

When tried to solve this problem, I found some articles that can be useful to someone else, but didn't solve problem in my case:

TFS not showing Dev branch in target locations for merging

How to merge new files into another branch in TFS?

http://revweblog.wordpress.com/2010/03/31/missing-target-branch-while-trying-to-merge-in-tfs-baseless-merge/

TnX in advance!

Nemanja

like image 620
Nemanja Vujacic Avatar asked Nov 05 '22 11:11

Nemanja Vujacic


1 Answers

I think the case you should look closer is this, it's a case you have already mentioned.

To your first question:
No, your method of committing new files multiple times is not optimum.
Adding a new file into source control (any source control) more than once, doesn't make sense.

To your second question:
The reason behind this behavior was best explained by AakashM in the post above: "In TFS the unit of change is the changeset, and it is changesets (not files) that are checked-in and merged. In the version (changeset number) that the target branch is at, this file simply does not exist, so there is nothing to merge to."

The proper way to operate is to add new files in your 'Development' branch and then merge into your 'Main' branch.
This will not be possible if you right-click on the newly added file & choose "Merge.." (no target-branch will be presented). This will be presented if you do this in the folder containing you new file(s).

like image 162
pantelif Avatar answered Nov 10 '22 04:11

pantelif