-->

Find changeset id parent of a branch in tfs

2019-02-18 03:49发布

问题:

With TFS, could someone tell me how to find the id of the changeset of the last commit common to 2 branches (or the trunk and a branch)?

It's easy to find the id of the first changeset of a branch (with 'tf history') but I could not find the parent of this commit :( Tfs seems to not keep (or display) this information!

Note : Take the previous commit id (ex : 119 if the first changeset id of the branch is 120) is not a solution because changeset id are incremented by all the commits on any branches on any projects in the tfs server (so the previous commit could be taken by another project, another branch of the same project)

I'm interested by a solution with the command line using tf command AND with the GUI...

回答1:

I wrote a blog post exactly about that: http://netexp.blogspot.com/2012/11/tfs-who-is-father-of-my-branch.html

In brief:

  1. It can be done via Visual Studio GUI (Track Changeset functionality). You need to track the first changeset in your child branch and then find max changeset in the parent branch (see a screenshot in the blogpost for details).
  2. It can be done via TFS Client API.
  3. You can use a simple command line app I developed.