Git學習之Git對象

=============================
Git對象
=============================
 (1) 查看日誌
  $ git log -l --pretty=raw
 (2) 查看Git 對象的ID的類型
  $ git cat-file -t 2d392
 (3) 查看Git 對象的內容
  $ git cat-file -p 2d392
 (4) 查看對象在對象庫中的位置
  $ for id in abe84366 b52c32e 6ed5ee6;
  do \ ls .git/objects/${id:0:2}/${id:2}*;
  done
 (5) 查看跟蹤鏈
  git log --pretty=raw --graph e695606
 (6) 查看當前分支
  git branch
 (7) 顯示引用對應的提交ID
  git rev-parse master

==============================
SHA1 哈希值
==============================
 (1) 查看HEAD對應的提交的內容
  git cat-file commit HEAD
 (2) 查看提交信息中包含的字符數
  git cat-file commit HEAD | wc -c
 (3) 在提交信息的前面加上內容 commit 234<null>(<null>爲空字符)
  執行哈希算法
  ${printf "commit 234\000"; git cat-file commit HEAD} | shalsum
 (4) 查看版本庫中文件的內容
  git cat-file blob HEAD:1.txt
 (5) 文件包含的字節數(大小)
  git cat-file blob HEAD:1.txt | wc -c

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章