NathanClouseAX / Article-Content-Requests

MIT License
0 stars 0 forks source link

Require work item on Git commit #3

Open FH-Inway opened 3 years ago

FH-Inway commented 3 years ago

Hey @NathanClouseAX , just saw the recording of your presentation on Git and D365FO at the Pakistan User Group event, good job. You mentioned in the recording that you set it up in such a way that creating a commit requires a linked work item. Could you do an article explaining how to do that? So far, I was only aware how to require linked work items for pull requests. When I last researched this, I ended up with the result that the Visual Studio Team Explorer Git integration does not play nicely with Git hooks, but it seems this works now with VS 2017: https://stackoverflow.com/questions/40991286/git-hooks-in-visual-studio

NathanClouseAX commented 3 years ago

I think I may have misspoke or didn't understand the question. When you create a PR, you can link to a work item that represents what requirement you're delivering on. You can also do the same thing when creating a branch. If you specify the work item when creating the branch, it will be remembered when you make the PR for that branch to pull it back into its source branch. All of the ALM and CI stuff we can do with TFVC can be done with Git in a similar or like way.

In a narrative, Let's say i have a new requirement called Feature3. I would create a work item for Feature3, document all the required changes in an FDD and TDD (or similar). Create a new branch from main linking that branch to the work item for Feature3. From there, create whatever build pipelines as required for Feature3's branch, hand it off to a dev to deliver, they do their thing and create a PR, with me doing a review. I can require that the PR have a linked work item so I know whatever is in that branch has a documented source. If not, reject it.

Does that answer your question? Would you like me to write something up to cover this in greater detail?

FH-Inway commented 3 years ago

Thanks for the explanation, seems it was a misunderstanding. I am aware of the option to set the branch policies to require a linked work item when doing a pull request. I was hoping you figured out how to do a git hook (which now with VS 2017 seems to be an option) to require a linked work item (basically, the text "#1234" must appear in the commit message) when doing a commit.

NathanClouseAX commented 3 years ago

With VS2019 support on the horizon, i'd be interested to know what addition options there may be to improve code related deliverables. I'm going to re-open this and hopefully I'll have some time to dedicate to this. Thanks!