我认为它实际上是 .git 的父目录,也就是我在其中运行 git -6ren">
gpt4 book ai didi

Git: "working directory"到底在哪里?

转载 作者:IT王子 更新时间:2023-10-29 01:17:27 26 4
gpt4 key购买 nike

我正在阅读一些 Git 教程。 “工作目录”的概念一直被提及,但是,我阅读的教程或文档都没有指出这个“工作目录”在哪里或什么。 p>

我认为它实际上是 .git 的父目录,也就是我在其中运行 git init 的目录。但是我正在观看的视频教程谈到了没有什么可提交和“工作目录干净”的状态:

In fact you can actually make a copy of the repository, and make that copy so that it does not have a working directory, this is actually called the bare clone. This is actually what GitHub uses.

如果我对“工作目录”的理解是正确的,那么仓库怎么可能没有“工作目录”呢?当它说 GitHub 使用“裸克隆”时,这是什么意思?

最佳答案

这有望为我们解决问题:

What is the difference between a repository created using the git init command and the git init --bare command?

Repositories created with the git init command are called working directories. In the top level folder of the repository you will find two things:

A .git subfolder with all the git related revision history of your repo
A working tree, or checked out copies of your project files.

Repositories created with git init --bare are called bare repos. They are structured a bit differently from working directories. First off, they contain no working or checked out copy of your source files. And second, bare repos store git revision history of your repo in the root folder of your repository instead of in a .git subfolder. Note… bare repositories are customarily given a .git extension.

取自John Saints - What is a bare git repository?

换句话说,裸 git 克隆不包含 check out 代码的工作目录。
将其视为没有任何其他内容的 .git 目录(Git 数据库)。

关于Git: "working directory"到底在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36201342/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com