What is the .git folder?

前端 未结 6 1963
别跟我提以往
别跟我提以往 2020-12-13 17:44

What is the folder called .git?

It\'s created in a repository. What is contained within it and why is created?

6条回答
  •  無奈伤痛
    2020-12-13 18:03

    .git is initialized by git init.

    .git contains all information required for version control. If you want to clone your repo, copy .git is enough.

    4 sub-directories:

    • hooks/ : example scripts
    • info/ : exclude file for ignored patterns
    • objects/ : all "objects"
    • refs/ : pointers to commit objects

    4 files:

    • HEAD : current branch
    • config : configuration options
    • description
    • index : staging area

    Here "object" includes:

    • blobs(files)
    • trees(directories)
    • commits(reference to a tree, parent commit, etc)

提交回复
热议问题