LoginSignup
0
0

More than 1 year has passed since last update.

gh コマンドで特定の PR のコミットハッシュをすべて取得する方法

Posted at

取得方法

調べてもすぐに情報が出てこなかったので備忘録として残しておく。

gh pr view <PR_NUMBER> --json commits --jq .commits[].oid [--repo <USERNANE>/<REPONAME>]

たとえば Pull Request #17516 · mastodon/mastodon のコミットハッシュをすべて取得するコマンドを例に挙げる。

リモートリポジトリに紐付いたリポジトリがローカルにない場合

gh pr view 17516 --json commits --jq .commits[].oid --repo mastodon/mastodon
d631b743c51a15994634314d6302fa33b9b49fef
d388a25dcddf93909d56f66872d48850e0194ca7
e2a97be470f3f4788dc850de4e352e85b5b567a7

リモートリポジトリに紐付いたリポジトリがローカルにあり、そのディレクトリにいる場合

--repo を省略できる。

gh pr view 17516 --json commits --jq .commits[].oid
d631b743c51a15994634314d6302fa33b9b49fef
d388a25dcddf93909d56f66872d48850e0194ca7
e2a97be470f3f4788dc850de4e352e85b5b567a7

参考

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