相关疑难解决方法(0)

做一个"git export"(比如"svn export")?

我一直在想是否有一个很好的"git export"解决方案,它创建了一个没有.git存储库目录的树的副本.我知道至少有三种方法:

  1. git clone然后删除.git存储库目录.
  2. git checkout-index 提到这个功能,但开头是"只需将所需的树读入索引...",我不完全确定如何做.
  3. git-export是第三方脚本,基本上git clone进入临时位置,然后rsync --exclude='.git'进入最终目的地.

这些解决方案都没有让我感到满意.最接近的一个svn export选项可能是选项1,因为这两个都要求目标目录首先为空.但是假设我可以弄清楚将树读入索引意味着什么,选项2似乎更好.

git export svn-export git-archive

2312
推荐指数
24
解决办法
62万
查看次数

为什么我不能从浅层克隆中推出?

git clone --depth命令选项说

--depth <depth> 
Create a shallow clone with a history truncated to the specified number of revisions. 
A shallow repository has a number of limitations 
(you cannot clone or fetch from it, nor push from nor into it),
 but is adequate if you are only interested in the recent history of a large project with a long history,
 and would want to send in fixes as patches. 
Run Code Online (Sandbox Code Playgroud)

为什么浅克隆有这种限制?为什么它只是一个补丁工作流程?

对于某些项目工作流程,我需要将最新的提交从单个分支传递给编码器,然后让它们能够push(快进)开发到主服务器.这部分是为了安全,知识产权保护和回购规模,部分是为了减少大回购会给天真编码员带来的困惑.是否有允许这样的git工作流程?


更新:根据Karl Bielefeldt的回答,git checkout --orphan …

git workflow git-clone

45
推荐指数
2
解决办法
3万
查看次数

标签 统计

git ×2

export ×1

git-archive ×1

git-clone ×1

svn-export ×1

workflow ×1