如何使用提交消息关闭GitHub拉取请求? [英] How to close a GitHub pull request with a commit message?

查看:475
本文介绍了如何使用提交消息关闭GitHub拉取请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的团队在内部使用pull请求来检查我们维护的应用程序,但是当需要合并提交时,我们只需直接推送到 master 。无论如何,我们都是repo collabs,并且通过 not 使用pull请求来合并代码,所以我们避免使用合并提交来污染我们的提交历史记录。由于该应用程序是我们团队的内部人员,因此没有其他人受到影响。

我想知道的是,我可以用关闭PR#30并让github自动关闭对我的请求?



我知道你可以使用提交消息来关闭问题,所以我希望有类似的拉请求。我在网上做了一个快速搜索,结果没有看到任何内容。

你可能想看看这个< gitHub帮助页面。它说:


您可以使用以下任一关键字通过提交消息来关闭问题:




  • 关闭

  • 关闭

  • 关闭


  • 修正

  • 修正

  • 修正
  • li>
  • 已解决


因此,修复#123或已解决#456将起作用。所有的拉取请求都被映射为问题,所以这也适用于拉取请求。



注意:因为您修改了拉取请求,您将看到有关未提交提交的消息。因此,查看pull请求,除非您在提交消息的第一行中放置了有意义的内容,否则将不会立即显示PR已合并(而不仅仅是简单关闭),因此您可以在pull请求中看到该消息。 / p>

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?

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.

解决方案

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.

这篇关于如何使用提交消息关闭GitHub拉取请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆