Dockerfile 深度实战:从指令底层原理到生产级镜像构建的艺术
2026/6/14 22:55:19
这是一个go语言编写的命令行git迁移工具:git-transfer。
特点:
git仓库地址发生变化,origin地址需要换成新的,支持单个仓库迁移和批量迁移两种模式。
git-transfer <新地址>- 单个仓库迁移,在项目目录下执行git-transfer --yaml [配置文件]- 批量迁移(默认: transfer.yaml),任意路径执行git-transfer --help- 显示帮助信息git-transfer https://github.com/user/repo.git git-transfer git@github.com:user/repo.git创建transfer.yaml配置文件:
projects:-name:"项目1"path:"./project1"old_origin:"https://old-server.com/user/project1.git"# 从old-origin克隆到本地path,然后推送new-originnew_origin:"https://github.com/user/project1.git"-name:"项目2"path:"./project2"new_origin:"https://github.com/user/project2.git"# 只写new_origin,从本地直接推送所有分支到new_origingit-transfer --make-repo gitea --yaml z_hedong.yaml --username admin --password123456然后执行批量迁移:
git-transfer --yaml my-config.yaml环境检查
备份当前配置
更新远程地址
git remote remove origin- 删除现有的origingit remote add origin 新地址- 添加新的origin地址推送代码
git push --all推送所有分支git push -f --all强制推送错误处理
--help显示所有可用命令和使用说明--yaml支持从配置文件批量迁移多个项目http://github.com/user/repo.githttps://github.com/user/repo.gitgit@github.com:user/repo.gitssh://git@github.com/user/repo.git