我有:
folder_a/app_1.0
folder_b/app_1.1
让我们说我正在处理两个文件夹/回购中的主分支。
如何将分支合并在一起?
答案 0 :(得分:43)
您必须将提交从一个存储库提取到另一个存储库,执行合并,然后返回到第一个存储库(如果您希望两个存储库都包含所有提交)。
# switch to repo A
cd folder_a
# Add repo B as a remote repository
git remote add folderb /path/to/folder_b
# Pull B's master branch into a local branch named 'b'
git pull folderb master:b
# Merge b into A's master branch
git merge b
# Switch to repo B
cd ../folder_b
# Add repo A as a remote repository
git remote add foldera /path/to/folder_a
# Pull the resulting branch into repo B's master branch
git pull foldera master:master