Merge code between two dfferent git repositories

I have readonly access to repo A and have my own repo B . Repo A contained multiple branches A1 , A2 etc repo B has branches B1 , B2 etc. Both repo A and repo B has remotes

Repo A branch A1 equal to repo B branch B1 folder F so how can I merge all changes from repo A branch A1 to repo B branch B1 folder F using git command by keeping all the history?

Currently I am just copying the files manually by overriding the content on B1 folder F which is not right I believe.

UPDATE what I've done so far:

1) on branch B directory i run a command git remote add A path/to/A

2) then git fetch A so I've got all stuff from repo A in my repo B

So the question now how can I merge branch A1 to branch B folder F there is a command git merge A/A1 but how can I specify that I want to merge branch A1 to branch B1 folder F in that command ?

链接地址: http://www.djcxy.com/p/23168.html

上一篇: 反转git fetch

下一篇: 在两个不同的git存储库之间合并代码