4.1.1.Working tree, Index/Cache, Repository and Object

  • Object

    • Git會將物件內容取出, 透過內容產生一組SHA1雜湊值, Git物件有四種: 主要是tree物件以及blob物件

      • 1.tree物件

        • 資料夾的概念, 可以包含 blob 物件的檔名與相關資訊或其他的 tree 物件

      • 2.blob物件

        • 將檔案內容進行 SHA1 雜湊運算後產生的hash id

      • 3.commit物件

        • commit 物件代表著 Git 的一次提交

          • 特定提交版本有哪些 tree 物件

          • 版本提交的時間, 紀錄訊息

          • 通常還會記錄上一層的 commit 物件名稱

      • 4.tag物件

      • tree, blob都位於物件儲存區(objects storage)物件:.git/object目錄底下

      • 透過tree, commit可以關連出blob間的關係

  • Index/Cache

    • Index是物件儲存區(objects storage)工作目錄(working tree)之間的媒介, git add等操作的目的是將物件加到索引中, git再依據索引的狀態, 決定要把那些檔案提交到儲存庫(Repository)

  • Working tree

  • Repository

Last updated