LoginSignup
2
2

More than 5 years have passed since last update.

gitオブジェクトのSHA-1コード計算(方法2)

Posted at

「gitオブジェクトのSHA-1コード計算」よりもっと簡単なやり方を見つけました。
1.オブジェクトのコンテンツを確認


$git cat-file blob ce01
hello

2.オブジェクトのコンテンツをblob-cat.txtに保存、ファイルサイズは6バイトと確認


$git cat-file blob ce01 > blob-cat.txt

3.ファイルの先頭に「blob 6\0」を追加して、blob-obj.txtに保存
4.SHA-1コードを確認


$cat blob-obj.txt | openssl sha1
ce013625030ba8dba906f756967f9e9ca394464a

他のタイプのオブジェクトも同じように確認できます。

参考資料:Git objects v2

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