4
4

一番最後の git リビジョン番号 を知りたい時のコマンド

Last updated at Posted at 2024-08-06
git log -n 1 --format="%H"

用心深く確認したいとき

$ git log -n 1 --format="%H" && git log | head -5

$ git log -n 1 --format="%H"
f9a3e2b6d7c8f1a4b0d2e3f4c9a1b7d6e8f5c0a3

$ git log -n 1 --format="%H" && git log | head -5
f9a3e2b6d7c8f1a4b0d2e3f4c9a1b7d6e8f5c0a3
commit f9a3e2b6d7c8f1a4b0d2e3f4c9a1b7d6e8f5c0a3
Author: ymatsukawa <ymatsukawa@example.com>
Date:   Thu Aug 1 14:31:25 2024 +0900

    fix: bye-bye tiny bug

使い所

  • squash でまとめる
  • (リビジョン番号をコピー) << ここ
  • ブランチ変更
  • リビジョン番号を基に cherry-pick する

mac OSX なら下のようにコピー可

git log -n 1 --format="%H" | pbcopy

# コマンド + v で貼り付け可

pbcopy はクリップボードへのコピー

4
4
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
4
4