0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

GitHub CLI(gh)でPull RequestのMerge Commit SHAを取得する

0
Posted at

はじめに

GitHub CLI(GitHub CLI)の gh コマンドを使うと、Pull Request の情報を JSON 形式で取得できます。その中に Merge Commit の情報も含まれているため、Commit ID(SHA)を簡単に取得できます。

コマンド

gh pr view <PR番号> --json mergeCommit

実行例

D:\app>gh pr view 64151 --json mergeCommit
{
  "mergeCommit": {
    "oid": "5dd5978f34c8b2ba9ff09c47965e71c5fe994edf"
  }
}

oid が Merge Commit の Commit ID(SHA)です。

環境情報

  • gh version 2.87.3 (2026-02-23)
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?