根据https://www.git-tower.com/learn/git/ebook/en/command-line/basics/basic-workflow#start
In Git, the repository is just a simple hidden folder named "
.git
" in the root directory of your project.
但是Git for beginners: The definitive practical guide说
A git repository is simply a directory containing a special
.git
directory
“存储库”是指 stash 的 .git
文件夹还是包含 .git
目录的目录?
我知道当您 git commit
时,您会将更改记录到本地 .git
文件夹中。这是否意味着当我们推送到 GitHub 上托管的远程存储库时,我们只是推送 .git
文件夹的内容而不是其他内容?
最佳答案
Does "repository" refer to the hidden .git folder or the directory containing a .git directory?
严格意义上,存储库只是 .git/
子目录。包含 .git/
和所有项目文件的目录名为 "working tree" ,严格意义上 .git/
子目录不属于工作树。
但人就是人,我们使用宽松的术语,因此我们经常将整个工作树 + .git/
称为“存储库”或“项目”或其他名称。
I know that when you git commit, you are logging changes into your local .git folder. Does this mean when we push to a remote repository like one hosted on GitHub, we are just pushing the contents of the .git folder and nothing else?
简短回答:是的。
更长的答案很复杂。是的,git push
仅从 Git 对象数据库推送对象,并推送引用(分支和标签)。但是 .git/
中还有更多永远不会推送或 pull 的内容:配置文件、 Hook 以及与当前存储库相关的许多其他文件和目录。
关于git - 存储库是 .git 文件夹还是带有 .git 文件夹的目录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59349277/