Automatically closing issue from pull request in GitHub

As you mention in the comments, the merge from the pull request will result in a commit.
It is on that commit message you can add a "close #xx" in order to trigger the closing of an issue.

However, as mentioned in "Closing multiple issues in Github with a commit message", in GitHub blog post "Closing Issues via Commit Messages" (January 2013), and in the current GitHub docs.

Now when you enter "Fixes #33" in a commit message, issue 33 will only be closed once the commit is merged into your default branch (usually master).

This is super useful because it means the issue's open / closed status will map to your default branch.
If the bug isn't fixed in your default branch, the issue will remain open.
Once the commit with the fix is merged into your default branch the issue will be automatically closed.

When you do make a commit in a non-default branch with the "Fixes #33" syntax, the issue will be referenced with a tooltip:

Closing Issue

You can use any of these keywords to close an issue via commit message:

close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved

As mentioned below by cosmolev (upvoted), the blog post from May 14th 2013 "Closing Issues via Pull Requests" adds pull requests as a way to close an issue:

some issues take more work than a single commit to close.
That's why you can now close an issue from a Pull Request.
All you have to do is include the special keyword syntax (eg. "fixes #5") in the body of your Pull Request.

comment on pull request

the referenced issue will automatically be closed when the PR is merged into the default branch.
It even works across repositories.

As John Eikenberry points out in the comments, the help page "Closing issues using keywords" does mention:

To close multiple issues, preface each issue reference with one of the above keywords.
You must use the keyword before each issue you reference for the keyword to work.

For example, This closes #34, closes #23, and closes example_user/example_repo#42 would close issues #34 and #23 in the same repository, and issue #42 in the "example_user/example_repo" repository.


It's finally possible: https://github.com/blog/1506-closing-issues-via-pull-requests

Just add resolve #18 to pull request message

where 18 is an issue number