VS/TFS 2012 Tidbits: Merging Changes by Work Item

As the Visual Studio family of products (Visual Studio, TFS, Test Professional) nears its 2012 release, I thought I’d bring some short hits – tidbits, if you will – to my blog. Some of these are pretty obvious (well-documented, or much-discussed), but some may be less obvious than you’d think. Either way, it’s always good to make sure the word is getting out there. Hope you enjoy!

Merging Changes by Work Item

This is something that existed in VS 2010, but it wasn’t talked about as much.  While it’s pretty straightforward to track changes merged across branches by changeset, sometimes it’s even more effective to track merges by work item (i.e. show me where changes associated with a work item have been merged/pushed to other branches).

Let’s catch up. Consider the relatively simple branch hierarchy below:


A work item has been assigned to Julia, Task #80.


Julia makes some code changes, and checks in against (linking to) the work item (Task #80).

She checks in 2 individual changes to create links to 2 discrete changesets from the task.

Now, it’s easy to go ahead and track an individual changeset by selecting the option from the History window.


That’s all well and good, but if I didn’t know the exact changeset ID (#17), or if there was more than one changeset in associated with the task, this tracking process becomes less effective.

What Julia can do is right-click on the work item and select “Track Work Item”.    (Note that this option will be disabled if there are no changesets linked to the work item.)


She can also click the “Track Work Item” button at the top of the work item form:


I get a much clearer picture now of all the work and where it’s been applied, and the “Tracking” visualization will now include all changesets (in my case, 2 changesets) in the window.

Now I know exactly what changes to merge.  I merge them, and now I can see that the entire work item has been merged to Main from Dev (i.e. both changesets were merged).


And just as effectively, I can see these changes in the Timeline Tracking view:


So that’s it! Tracking by work items are pretty easy to do, and paint a much clearer picture of how a change from a work item perspective can, or has been, applied across branches.

Again, I know this isn’t exactly a new feature, but there are a lot of people out there who are looking for ways to “merge by work item” and aren’t aware of this feature.

Comments (4)

  1. Dan Morgenstern says:

    Sorry Steve, but there's no merging here. track work item is a great feature but it's not merge by work item.

  2. Automation Planet says:

    thanks for tip

  3. slange says:

    @Colin – I don't know that there's a convenient way to merge by multiple work items at a time. Some might argue that merging changesets that are related to different work items all at the same time could reduce the discrete traceability of change propogation. By merging one work item's changes at a time, you maintain complete traceability, and make it easier to roll out (or roll back) a specific work item change.

    But I do get what you mean – Perhaps there's a CodePlex or VS Gallery utility that can help you?

    Thanks for your comment!

  4. Colin Dembovsky says:

    Hi Steven – I didn't know you could track by work item until I read this post – great tip!

    This allows you to merge 1 work item easily – I think there's still some folk who want to be able to merge more than 1 work item at a time. So to use your example, you're tracking Task 80 (and merging changesets 17 & 18). What if I wanted to merge all the changesets for Task 80, 82, 85 and 87?