What's the -practical- difference between a Bare and non-Bare repository?

后端 未结 11 2168
南方客
南方客 2020-11-22 16:16

I\'ve been reading about the bare and non-bare / default repositores in Git. I haven\'t been able to understand quite well (theoretically) about the differences between them

11条回答
  •  情话喂你
    2020-11-22 16:38

    The distinction between a bare and non-bare Git repository is artificial and misleading since a workspace is not part of the repository and a repository doesn't require a workspace. Strictly speaking, a Git repository includes those objects that describe the state of the repository. These objects may exist in any directory, but typically exist in the .git directory in the top-level directory of the workspace. The workspace is a directory tree that represents a particular commit in the repository, but it may exist in any directory or not at all. Environment variable $GIT_DIR links a workspace to the repository from which it originates.

    Git commands git clone and git init both have options --bare that create repositories without an initial workspace. It's unfortunate that Git conflates the two separate, but related concepts of workspace and repository and then uses the confusing term bare to separate the two ideas.

提交回复
热议问题