How to close a GitHub pull request with a commit message?

My team uses pull requests internally for code-reviewing the application we maintain, but when it’s time to merge a commit, we just push directly to master. We’re all repo collabs anyway, and by not using the pull request to merge code, we avoid polluting our commit history with merge commits. Since the app is internal to our team, no one else is affected.

What I want to know is, can I amend my commit message with something like "closes PR #30" and have github automatically close the pull request for me?

  • Installing Git with Homebrew not working
  • How to view content of commit-id shown by git rebase?
  • Git: How configure KDiff3 as merge tool and diff tool
  • Locking binary files using git version control system
  • Eclipse Git plugin - remove file from repo without deleting local
  • Error encountered while cloning the remote repository with VS 2015 Update 3 (TFS 2015 Update 3)
  • I know you can use commit messages to close issues, so I’m hoping there is something similar for pull requests. I did a quick search online and of SO, and didn’t see anything.

  • Android studio library iml file forces position in host project
  • move one commit to the top of all commits
  • Git: can't commit a file even though I've resolved the conflict
  • Reset remote git branch
  • Revision Control System Recommendations
  • How to point Hudson build to my local git repository?
  • One Solution collect form web for “How to close a GitHub pull request with a commit message?”

    You probably want to look at this GitHub help page. It says:

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

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

    So “Fixes #123” or “Resolved #456” will work. All pull requests are mapped as issues, so this will works for pull requests too.

    Note: you’ll see a message about unmerged commits because you amended the pull request. So looking at the pull request, it won’t be immediately obvious that the PR was incorporated (versus just plain closed) unless you put something meaningful in the first line of the commit message so you can see the message in the pull request.

    Git Baby is a git and github fan, let's start git clone.