gpt4 book ai didi

git - 有 git uncheckout 吗?

转载 作者:太空狗 更新时间:2023-10-29 13:33:03 25 4
gpt4 key购买 nike

使用 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 have bare = true instead of bare = false
  • removing the contents of your_repo/* other than the .git file
  • moving the .git dir contents into your_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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com