[英]Append a newer Git repo onto an older repo to combine both histories
I've got two related git repositories on GitHub that should really be one. 我在GitHub上有两个相关的git存储库应该真的是一个。 How do I combine both projects into one project, in a way that satisfies the following context:
如何将两个项目组合到一个项目中,以满足以下上下文的方式:
.gitignore
, readme.md
, and package.json
. .gitignore
, readme.md
和package.json
。 You can: 您可以:
Here is a clean way to do it: 这是一个干净的方法:
git remote add b https://github.com/your-username/your-b-repo.git
git fetch b
git checkout -b b-master b/master
git rebase master
# fix conflicts if any
git checkout master
git merge b-master
git branch -d b-master
b
to the local primary repository b
辅助远程存储库添加到本地主存储库 b-master
and checkout to it b-master
并将其签出 rebase
command rebase
命令将您在A存储库中执行的所有操作放在B存储库中
master
branch (on A) master
分支(在A上) master
branch (A) to the b-master
branch (B) master
分支(A)合并到b-master
分支(B) b-master
branch b-master
分支
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.