2

We maintain multiple TFS branches in our release cycle. The current process is to cherry-pick changesets from the WIP branch into a Test branch when user stories are completed.

I am mostly curious to know if git-tf allows working with multiple remote branches this way, and if it is capable of checking in a merge versus checking in code that looks like new code.

There was a discussion about this here:

Merge two TFS branches with git tfs

and it was mentioned that git-tfs would not play nice with others who would use VS directly. Does anyone know if that's the case with git-tf?

1 Answer 1

5

At this time,git-tf does not represent TFS branches with git branches and does not translate merges in either direction - that is to say that it will not check in a merge, nor will it display the results of a TFS merge as a git merge. This is a sort of nontrivial problem, since there are some pretty fundamental differences between merges in the two architectures.

TFS merges as git merges:

In git, you merge two commits and end up with a resultant commit. TFS seems similar - in that you choose a merge source and target changeset, but the merge source need not be a changeset. You can merge based on labels, workspace versions, dates, etc. Which means that you can ultimately end up merging different files from multiple different changes. This is the easy problem to solve (ultimately, I would presume, representing it as some crazy octopus merge).

A harder problem to solve is creating git branches based on TFS branches. This is more a setup problem - ie, which branches do you want? all of them? some of them? If the answer is "all of them", then it's easy to set up when you do your initial clone. But for me, that's - trivially hundreds of branches and sort of expensive to set up the first time. If the answer is "some of them" then you've got to specify them all when you do your clone or else you'd end up rewriting git history in nasty ways later.

git merges as TFS merges:

In git, branches are sort of ephemeral. It's really just a pointer to a node in the tree... There's no long-lived state that says "commit 1b4caf was once in branch branch." Imagine that you had some git branch master pointing to TFS branch $/Proj/main and another git branch test pointing to $/Proj/test. In git, you merge test into main. No problem, at this point main's HEAD commit has a parent that is test's HEAD. But if you start changing things in the test branch, this could quickly becomes quickly difficult to determine.

Further, right now git-tf maps a single git branch to your TFS server path. For merge checkins, we'd have to check into multiple branches at once. Let's say you made a few commits to master and a few commits to test and then merge each of their HEADs. Now we have to checkin several commits to each TFS branch, then do the merge. This isn't necessarily hard, but it's a very radical departure from the way git-tf works currently.

This isn't by any means an impossible problem, but it will take a bit of clever engineering and a whole lot of clever testing. But it's not there yet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.