合并两个git仓库,并保留每个仓库的历史
来源:互联网 发布:启动mysql错误1067 编辑:程序博客网 时间:2024/05/01 11:58
问题:有两个git仓库 repository1和repository2,想把repository2合并到repository1,并在repository1中保留repository2的所有分支历史
方案: 1.在repository1中添加远程分支,,跟踪repository2,并把repository2全部分支拉到repository1中,命令为:
git remote add other /path/to/repository2
git fetch other
2.第一步执行完后,在repository1工作目录中.git/refs/remotes/ 文件夹下有个other文件夹,ohter文件夹里是所有的repository2分支,因此只要把这些分支设置成repository1分支即可,命令为:
for branch in `ls .git/refs/remotes/ohter`
do
if test "${branch}"="master"
then
git checkout -b othermaster other/${branch}
else
git checkout -b ${branch} other/${branch}
fi
done
参考:http://stackoverflow.com/questions/1683531/how-to-import-existing-git-repository-into-another
- 合并两个git仓库,并保留每个仓库的历史
- 合并两个git仓库
- git 合并两个仓库
- 合并两个git仓库
- Git合并两个仓库
- 合并两个git仓库
- git如何合并两个仓库
- commit日志历史不一致的Git仓库合并
- 合并本地git仓库
- svn迁移到git仓库并保留commit历史记录
- svn迁移到git仓库并保留commit历史记录
- Git 仓库中删除大文件的历史提交记录
- git pull取得远程仓库的对像并刷新、合并本地数据git fetch+get merge
- 将其他远程仓库的代码合并到本地,并将本地仓库的代码提交到其他远程仓库
- git仓库的组成
- Git的远程仓库
- git 两个中心仓库上的分支 merge
- 将Git工程提交到两个不同的仓库
- POJ 2031 Building a Space Station
- 使用keepalived做双机热备
- VC++串口通信编程详解
- 初见memcached
- java,jsp+eclipse+mysql5.6搭建环境
- 合并两个git仓库,并保留每个仓库的历史
- WEP&WPA Cracking on BT5/MAC [转]
- android system wake
- 安装HP LaserJet 1020驱动(Ubuntu)
- hdu4314
- 开源 免费 java CMS - FreeCMS1.2-标签 config
- POJ 3628 Bookshelf 2(背包)
- 选择技术还是选择销售? 肖舸
- Arcgis10 sde + desktop + web server安装、破解、配置流程for windows