Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TFS 2012 checking if a branch has been merged

I have recently moved from Mecurial to TFS 2012 to take care of source control. So far I really like it, but I am just stuck on one aspect of it, so I was hoping someone on here can help me.

Let's say I have a branch called "Main", and then I branch from this, calling it "Feature 1". I can work on the modifications in "Feature 1" and then at this point Mecurial would draw a fork in the road.

If I then merge my "Feature 1" changes into "Main", Mecurial would then visually join the fork back up again. I could then make some more modifications to "Feature 1" which would cause another split, and once again, Mecurial would give me visual representation of this.

I have tried the same in TFS, and although the actual branching and merging is very easy, what is hard to work out is if the latest changes within "Feature 1" have been merged into "Main", or if there are outstanding changes to be merged.

The "Track Changeset" feature comes close and will let me know that "Feature 1" has been merged with "Main" at some point, but it doesn't display if "Feature 1" has been modified since the last merge.

Basically what I'm asking in a nutshell is, "How can I tell if a branch has any changes since the last time it was merged with the parent?"

Perhaps I am just stuck in the ways of which Mecurial used to do things, but I'd really appreciate some help or guidance with the above problem.

like image 594
Laurence Frost Avatar asked Aug 06 '13 12:08

Laurence Frost


People also ask

How do you check if branch is merged or not?

You can use the git merge-base command to find the latest common commit between the two branches. If that commit is the same as your branch head, then the branch has been completely merged.

What is a baseless merge?

A "baseless merge", that is a three-way merge of two files without a common ancestor (or "base"), means that you can't identify what regions of a file are new and what are common. So it is going to produce conflicts in any system, be it Git or TFVC.


1 Answers

Update:

There is no visual indicator for this in TFS, but "TF.exe Merges" command is the closest that you can get to that particular feature. TF.exe Merges + Track Changeset + View History will help you achieve this.

Format: tf merges [source] destination [/recursive] [/extended] [/format:(brief|deltailed)] [/login:username, [password]] [/showall]]] [/collection:TeamProjectCollectionUrl]

Open your visual studio command prompt and type tf.exe merge /? for more details.

Example:

tf.exe Merges /recursive C:\projects\Main C:\projects\Dev

Changeset   Merged in Changeset   Author     Date
> --------------------------------------------------------   
135         162                   user1     4/13/2013 

146         162                   User2     5/16/2013 

147        167                   User1     6/18/2013

When you run this, you will get the last changeset which was merged from a MAIN branch to the DEV branch. Note the last changeset number which was merged (147 in this case). You can go back to the Main branch -> view history and check if there are any new changesets added after 147 in Main. In that case, you will have to do a Merge, else no.

Makes sense?

Also one more thing, I would suggest is to force the developers who do the merge to use a specific format for the check-in comments during merge, for example

"******MERGE****** Source branch name, the last changeset etc". 

This would also help, but dont count on it since people may not do it or will make mistakes.

MSDN LINK

like image 74
Isaiah4110 Avatar answered Oct 02 '22 20:10

Isaiah4110