当启动一个git repo时,有什么区别? [英] what difference does --bare switch make when initing a git repo?

查看:141
本文介绍了当启动一个git repo时,有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题与这个问题有些相关:是否有可能在另一个git仓库中拥有一个git仓库

p>

下面是总结:



我有一个git仓库,我把它推到了我的虚拟主机上。我分离了该回购的子目录,并将该子目录添加为子模块。现在我要从我的虚拟主机中删除该子目录,在那里创建一个空的git存储库,并将子模块推送到那里。所以,我想知道做什么 - 不需要切换,我需要它。



作为一个便笺,我是git初学者。

解决方案

- bare 开关使得存储库没有工作目录;您将无法检出任何分支或直接操作文件。



没有 - bare 存储库数据将会在 $ REPO_ROOT / .git 中创建。使用 - bare 存储库数据将在 $ REPO_ROOT 中创建。



当存储库的目的是作为其他存储库的克隆/推/拉点时,您通常会使用此选项。


This question is somewhat related to this question: Is it possible to have a git repo inside another git repo

Here is the summary:

I had a git repo, which I pushed to my web host. I seperated a subdirectory of that repo, and added that subdirectory back as submodule. Now I am going to remove that subdirectory from my web host, create an empty git repository there, and push my submodule there. So, I was wondering what does --bare switch do, and do I need it.

As a side note, I am git beginner.

解决方案

The --bare switch makes it so that the repository has no working directory; you will be unable to check out any branches or manipulate files directly.

Without --bare the repository data will be created in $REPO_ROOT/.git. With --bare the repository data will be created in $REPO_ROOT.

You'd typically use this option when the purpose of the repository is to serve as a clone/push/pull point for other repositories.

这篇关于当启动一个git repo时,有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆