把 Git 仓库打包成单文件传输
git bundle 把提交和引用打包成一个文件,适合离线传输、内网导入和镜像同步。接收方可以像克隆普通仓库一样从 bundle 克隆或拉取。
git bundle create repo.bundle --all
git bundle create main.bundle main
git bundle create update.bundle v1.2.0..main
git bundle verify repo.bundle
git clone repo.bundle app
git fetch repo.bundle main:refs/remotes/bundle/main
git bundle list-heads repo.bundle
main 不会包含其他分支和 tag。verify 会报缺少 prerequisite。git bundle create - 可输出到 stdout,但大仓库要注意管道和磁盘。git clone repo.bundle 时,bundle 必须包含 HEAD 指向的分支。git bundle verify,确认引用和对象完整。git — 版本控制git-archive — 导出源码快照git-lfs — 大文件