我有一个本地回购A,只有一个分支(master
)和一个远程回购B.每个回购都有自己的历史记录。
我想将rep的A master
分支推送到repo B中名为branch1
的新分支。我该怎么做?
答案 0 :(得分:2)
如果您想将(本地)回购A上的master
分支推送到(远程)回购B上名为branch1
的新分支,则需要
确保B在correc URL处列为存储库A的远程存储库:在repo A中,运行
git remote -v
如果您没有在列表中看到与repo B对应的URL,则需要使用
将repo B添加为存储库A的远程git remote add <remote-name> <url>
在下文中,我假设存储库B被列为远程名称repoB
下的存储库A的远程。
执行推送:在回购A中,运行
git push repoB master:branch1