Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger "Merged" status for a pull request with commit message

Tags:

git

merge

github

Like some others, I'm not fond of the default "Merge Pull Request" button behavior, so instead I get things in shape on the local command line, then push back to the repo. I'd like for that push to automatically resolve the original PR as "Merged."

Using the magic strings specified here (found from similar SO question here) is almost what I want. Unfortunately, including closes #123 marks the PR as "Closed", which by itself is kind of synonymous with "Rejected".

I would like to know if there is a way to trigger the same "Merged" status (w/ purple icon) that you get when you just press the button.

So far I've tried adding the following to my commit messages, to no avail:

  • closes #xyz (just sets Closed status and associates)
  • Merge pull request #123 from user/fork (just associates)
like image 482
latkin Avatar asked Jan 15 '15 22:01

latkin


1 Answers

GitHub considers a PR "Merged" as soon as the commits in the PR branch are also found in the target branch (typically master). Using a rebase workflow, your process might look like this:

  1. Create a branch tracking your PR branch: git checkout -t origin/my-pr-branch
  2. git rebase master
  3. git push -f origin my-pr-branch (or just git push -f if you've changed push.default to something sane)
  4. Push your changes to remote and local master, closing the PR: git push origin HEAD:master && git push . HEAD:master
like image 160
dahlbyk Avatar answered Oct 06 '22 03:10

dahlbyk