Help us understand the problem. What is going on with this article?

Git | 現在のコミットハッシュを得るエイリアス

More than 3 years have passed since last update.

解決

専用コマンドがあるようだ。コメント欄を参照のこと。

最初の解決

エイリアスを作っておけば。
$ git revision と打つだけで、簡単にコミットハッシュを得られる。

.gitconfig
[alias]
  revision = !git show -s --format=%H

例:

$ git revision
55176575a31a65118760c30e64cde839e9bb20a3

応用

HEAD を指定すれば、過去のコミットハッシュを得るのも簡単だ。

$ git revision HEAD^

$ git revision HEAD^^

環境

  • git version 2.3.8 (Apple Git-58)

参考

Yinaura
https://twitter.com/yumainaura / mv here http://qiita.com/Yumainaura / yumainaura / 稲浦悠馬 / いなうらゆうま
https://twitter.com/yumainaura
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした