“Git directory” and “working directory”

守給你的承諾、 提交于 2019-12-11 12:27:42

问题


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.

So I expected that when I clone some repo from GitHub, as shown below:

git clone git://github.com/schacon/grit.git .

I should just download the .git directory.

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.

Why?

Thanks.


回答1:


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 somebody else's working diretory. Its yours ;)

If you just want the bare .git folder, use --bare or --mirror keys.



来源:https://stackoverflow.com/questions/7188314/git-directory-and-working-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!