Associating git commits with Team Foundation work items

Wilbert picture Wilbert · Feb 18, 2013 · Viewed 16k times · Source

Context

A GitHub Enterprise installation used for development. Every developer has his own public repo, and the organization has the authorative repo. Pull requests are used for code reviews, and we loosely follow nvie's git flow branching model.

A TFS installation used for issue tracking and deployment (the release branch). We mirror the release branch into a TFS repo.

Work Items

Now the hard part is: How do we associate git commits (that may originally be done on the public branches of the developers) with TF work items?

What I did

I've looked at the following projects for help:

I've read references to associating commits with work item in both Git-TF projects, but I am unsure what tool to use, and how to go about it exactly.

I would be fine if I had to run a script on the release branch commits to extract work item references from the commit message and associate them with changesets sent to TFS. However, a solution that allows the association in metadata (instead of commit messages) would be preferred.

What are my options to associate work items in TFS with git commits?

Answer

mcstar picture mcstar · Feb 21, 2014

If you use # in your git commit message as in git commit -m'fixes #123' TFS will automatically add the commit as a linked item in workitem specified.