Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge two TFS branches with git tfs

Tags:

git

tfs

git-tfs

I'm using git-tfs, and I was wondering if it is possible to merge two TFS branches using git-tfs. I have two branches $/MyCompany/Dev & $/MyCompany/Release-3.3. Release-3.3 originates from the Dev branch. Both are checked out as different git repositories using git tfs.

I'd like to re-incorporate the changes back into the Dev branch. Can this be achieved with git-tfs or will I have to resort to trying to do it using TFS tools?

like image 735
Ceilingfish Avatar asked Dec 19 '11 10:12

Ceilingfish


People also ask

How do I merge two TFS branches?

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.

How do I merge two projects in TFS?

Click the File menu, point to Source Control, point to Branching and Merging, and then click Merge. The Source Control Merge Wizard will displayed. 3.In the Target branch drop-down list, select the target team project branch to which you want to merge the source branch(first branch). 4.

How do I merge branches in remote repository?

The idea here, is to merge "one of your local branch" (here anotherLocalBranch ) to a remote branch ( origin/aBranch ). For that, you create first " myBranch " as representing that remote branch: that is the git checkout -b myBranch origin/aBranch part. And then you can merge anotherLocalBranch to it (to myBranch ).

Can I merge two feature branches?

Merge branchesMerging your branch into master is the most common way to do this. Git creates a new commit (M) that is referred to as a merge commit that results from combining the changes from your feature branch and master from the point where the two branches diverged.


1 Answers

Since git-tfs 0.16, you can manage TFS branches (with branch command) so you can now easily init existing branch, create one and merge TFS branches!

https://github.com/git-tfs/git-tfs/blob/master/doc/commands/branch.md#initialize-an-existing-tfs-branch

And since the release 0.19, you can do a git merge of 2 TFS branches and checkin it in TFS (with rcheckin) and it will be checked in as a merge changeset : https://github.com/git-tfs/git-tfs/blob/master/doc/commands/rcheckin.md#checkin-a-merge-changeset

The only limitation (due to TFS) is that all the commits should have been already checked in TFS before doing your merge with git and check it in TFS.

So you can now merge more easily than with 2TFS branches and check them in...

like image 172
Philippe Avatar answered Oct 07 '22 03:10

Philippe