Git – Which commit should close a Github issue when multiple commits are responsible

gitgithub

I want to close issues in Github via my commit messages, but I'm not sure which commit should contain the magic "Closes #XXX" string when multiple commits are responsible for closing the issue. Specifically, I'm wondering if the last commit on my feature branch (always merged with --no-ff) should close the issue, or if I should close it via the merge commit that sort of "summarizes" the entire feature branch? Is there a standard way of doing this, something endorsed by the Git community?

Best Answer

I generally vote for "the commit that merges the fix branch into the main line of development". Related commits should reference the issue.

Related Topic