作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
使用 git clone
有一个选项 -n
可以防止在克隆存储库后检查 HEAD
。是否可以手动执行此操作?
编辑 我认为手册中的选项 -n
读起来比实际情况要好:使用 -n
克隆后,我的所有工具都显示我仍然住在 master 分支上;唯一的区别是所有文件都显示为已删除。这与我称之为“未 checkout ”的情况完全不同。
所以也许我应该删除 HEAD
?
最佳答案
最简单的解决方案是直接克隆它:
git clone --bare your_repo bare_repo
(并删除你 checkout 的 repo )
基本上,您需要将您的存储库转换为裸存储库,根据 this question , 可以手动完成:
- changing the
.git/config
file to havebare = true
instead ofbare = false
- removing the contents of
your_repo/*
other than the.git
file- moving the
.git
dir contents intoyour_repo/
and removing the.git
dir
另见 Git: Convert normal to bare repository , 如 MikeSep 所述在评论中。
如果您需要取消 checkout ,请将 bare
设置为 false
,并简单地删除除 .git
之外的所有内容。这应该类似于 git clone -n
。
关于git - 有 git uncheckout 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2311958/
使用 git clone 有一个选项 -n 可以防止在克隆存储库后检查 HEAD。是否可以手动执行此操作? 编辑 我认为手册中的选项 -n 读起来比实际情况要好:使用 -n 克隆后,我的所有工具都显示
我是一名优秀的程序员,十分优秀!