TFS reverse integration back to main

2019-07-03 22:48发布

I have the Development branch forked from the Main branch.

Could I merge the Development branch back to the Main so that Main branch code would be equal the Development branch?

What is the most safe and reliable solution for this?

2条回答
Emotional °昔
2楼-- · 2019-07-03 23:06

I admit one work place they merged the Trunk to the Branches, but its not supposed to work that way.

The generally accepted method is merge the Branch back into the Trunk.

It sounds like you are working in the Trunk ("I can create some additional folder or additional files in the trunk") and wanting to merge into the Branch.

I recommend doing it the standard way: only work in Branches merging back to the Trunk, never coding directly in the Trunk.

查看更多
\"骚年 ilove
3楼-- · 2019-07-03 23:13

The easiest way I've found to do this is to do a merge using Visual Studio and the Source Control Explorer.

In the Source Control Explorer, right-click on your development branch and select Branching and Merging > Merge

In the Target Branch drop-down select your trunk ("Main") as the destination. This is likely the default selection if you've branched from Main originally.

There are two options:

  1. All changes up to a specific versions: You choose based on a revision and merge it all up to that revision in one fell swoop. If you have a lot of changes, this can save you some time, but also is riskier in terms of resolving conflicts if there have been a lot of changes in Main.
  2. Selected changesets: You select single or groups of changesets to merge back and then repeat this process until you've merged back what you need. Less risky option, but much more time consuming. I personally prefer this approach so that I can see the changes going back into the trunk and know what to expect as changes.

TFS will instruct you if there are merge conflicts while you are merging. This occurs when you change something in the trunk after you've branched to your development. If one of the changes you've made in development conflict with the changes you've made in the trunk, you will have the chance to resolve this in Visual Studio.

If you do not have any conflicts, your development changes will move into the Trunk and simply merge with the changes you already have there.

查看更多
登录 后发表回答