LoginSignup
20
23

More than 5 years have passed since last update.

Githubのkeywordを利用してPull Requestがマージ、クローズされたタイミングで関連するIssueも同時に閉じる

Posted at

プルリクをマージしたり、クローズした後にいちいち関連するIssueをクローズしたりするのは面倒です。
GitHubではkeywordという予約語があり、その予約語のあとにIssueの番号を書くとプルリクがマージ、クローズされたタイミングでIssueもクローズしてくれます。

おすすめはプルリクのテンプレにkeywordを入れておく方法です。
[GitHub] IssueとPull Requestのテンプレート機能を利用してフォーマットを統一する

この記事は個人ブログでも掲載しています。
http://tackeyy.com/blog/close-github-issue-after-pull_request-is-merged-or-closed

プルリクの内容の書き方

fixes #1 のようにkeywordとIssueの番号をセットで記載します。

https://gyazo.com/8d73e266e62b93ea1f3cd2cde08e9f83

https://gyazo.com/0698f5b2e3e3da1947bccfbea17ec72d

keywords

以下の単語がkeywordとして使えます。

This pull request fixes #1 の省略形の fixes #1 が自然かなあと思ってぼくは fixes を使うようにしました。(resolvesでもいいのですが、文字数が少し長い・・・w)

close
closes
closed
fix
fixes
fixed
resolve
resolves
resolved

コミットメッセージにキーワードを入れてIssueをクローズする方法もある

$ git commit -m "Fix screwup, fixes #12" のようにkeywordとIssue番号を入れると同じことができます。

参考

https://help.github.com/articles/closing-issues-using-keywords/
https://github.com/tiimgreen/github-cheat-sheet#closing-issues-via-commit-messages

20
23
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
23