Why is it such a pain to merge with feature branches in TFS?
We have a HEAD branch and a feature branch that was created from the HEAD branch. I am developing on the traits branch and constantly merging changes from HEAD to my branch.
When I have finished this function, I will try to combine it with HEAD. This is assumed to be a 0-pain operation, since all conflicts have already been resolved in previous merges to the feature branch. However, this never happened.
I end up copying all the content of my branch and overwriting the HEAD branch. This was the situation in Team Foundation System 2005 and 2008. Is this a bug or am I doing something wrong?
source to share
This is really the way it is. Let's say we have two changesets in our trait branch and then merge the new changeset from the title.
Head: Base ----------------> H1 - \ \ Ftre: -> Branch -> F1 -> F2 -> H1 '
Note that H1
- this is a different checkin for H1'
, even if no change (conflict resolution)
When we now merge into the Head from Ftre, we have changes F1
, F2
and H1'
, that are performed from Base
, but Head has an additional set of changes H1
after Base
.
Since we know that the change commands that we merge back into Head contain all the functionality H1
, there is no problem with undoing changes in Head (i.e. changeet H1
) and using only changesets from Ftre. However, you cannot do it from the GUI (unless the latest version allows it) and it has been a while since I used TFS to give you the command line syntax unfortunately.
source to share
I was able to overcome this disadvantage in two ways.
-
I never merge with the main or HEAD until the function is done. (Works in cases where changing HEAD is irrelevant to the function.)
-
It's complicated. Every time I decide to merge HEAD with a feature branch, I create what I call an integration branch from HEAD. Then I do an unreasonable merge of the feature branches change branch or the first set of changes in feature branches. This puts the files together and is the argument that TFS should allow me to provide or discover a base between two siblings. (I feel it has to do with a non-branching story. Team Foundation Power Toys is fixing this issue.) Of course, to finish establishing the relationship. Then I do a regular merge between the feature branch and the new integration branch. This allows me to merge the elements of a feature branch into one changeset. Then I disconnect my integration branch and let my feature branch die. Of course I am losing history in the feature branch, but I'm not sure ifthat it interested me.
Sorry, this is so difficult.