是否可以下载所有提交但不能下载文件本身?我想运行bisect,但要从构建服务器下载版本,而不是自己编译。
答案 0 :(得分:4)
如果您不想为每次迭代检出新的工作树,则在运行git bisect
时可以提供--no-checkout
作为参数。
git clone --no-checkout
采取同样的措施以避免克隆后基于HEAD的工作树。
您可以运行git bisect run my_script arguments
使my_script
做任何您想做的事情。
总结:
git clone <repo> --no-checkout
git bisect --no-checkout run my_script arguments
编辑:
按照@phd的建议,由于git的最新版本(v2.2x),现在支持“部分克隆”,这意味着您可以提供克隆“过滤器”。
在您的情况下,我们将使用--filter=blob:none
和--filter=tree:0
并且仅保留提交对象,但是这要求服务器安装的git版本可以理解过滤器,否则您将获得警告:
warning: filtering not recognized by server, ignoring
您将要使用的克隆命令:
git clone <repo> --filter=blob:none --filter=tree:o --no-checkout