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?

1 Answer 1


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

  • +1. You only know if the issue can really be closed once you've tested it, and for pretty much all sane workflows I've seen so far, this means the code has to be committed already (running decisive tests on uncommitted code is madness).
    – tdammers
    Feb 1, 2012 at 20:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.