将git repo合并到另一个repo的分支中 [英] Merge git repo into branch of another repo
问题描述
baz
的独立分支中。 git checkout -b baz
< =将Bar回购放在这里。
您无法将存储库合并到分支中。您可以将本地存储库中另一个存储库的分支合并到分支中。假设您有两个存储库, foo
和 bar
都位于您当前的目录中:
$ ls
foo bar
更改为 foo
存储库:
$ cd foo
将栏
存储库添加为远程分支并获取它:
$ git remote add bar ../bar
$ git remote update
在中创建一个新分支
存储库基于您当前的分支是什么: baz
foo
$ git checkout -b baz
从合并分支
资源库到当前分支: somebranch
bar
$ git merge bar / somebranch
code>
Given repo Foo and repo Bar. I want to merge Bar with Foo, but only into a separate branch, called baz
.
git checkout -b baz
<= put the Bar repo here.
You can't merge a repository into a branch. You can merge a branch from another repository into a branch in your local repository. Assuming that you have two repositories, foo
and bar
both located in your current directory:
$ ls
foo bar
Change into the foo
repository:
$ cd foo
Add the bar
repository as a remote branch and fetch it:
$ git remote add bar ../bar
$ git remote update
Create a new branch baz
in the foo
repository based on whatever your current branch is:
$ git checkout -b baz
Merge branch somebranch
from the bar
repository into the current branch:
$ git merge bar/somebranch
这篇关于将git repo合并到另一个repo的分支中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!