“Git目录”和“工作目录” [英] "Git directory" and "working directory"
问题描述
如果我理解正确, Git目录 是隐藏的名为 .git 的directoy,它位于 工作目录 。所有的代码和历史信息都存储在Git目录中。
If I understood it correctly, Git directory is the hidden directoy named .git which resides in the working directory. And all the code and history info is stored in the Git directory.
所以我期望当我从GitHub克隆一些repo时,如下所示:
So I expected that when I clone some repo from GitHub, as shown below:
git clone git://github.com/schacon/grit.git .
我应该下载 .git 目录。
除了隐藏的 .git目录以外,工作目录中还有很多其他文件。我没想到会下载其他人的工作目录。
But there're plenty of other files in the working directory besides the hidden .git directory. I didn't expect to download other people's working directory.
为什么?
谢谢。
推荐答案
Git通过创建对应于 master
的文件自动为您准备工作目录。分支(或者你配置为默认分支的任何东西)。这不是一些elses工作diretory。它是你的;)
Git automatically prepares the working directory for you by creating the files corresponding to the master
branch (or whatever you have configured as the default branch). It is not some elses working diretory. Its yours ;)
如果你只想要 .git
文件夹,使用 - -bare
或 - mirror
。
If you just want the bare .git
folder, use --bare
or --mirror
.
这篇关于“Git目录”和“工作目录”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!