保持两个上游Git Repos同步

时间:2015-12-24 12:40:43

标签: git

我有一个工作Git存储库,它只在内部网络(origin / master)上可用。

出于这个原因,我有一个私人仓库(私人/主人)并且有一个主分支,它将两个repos设置为远程。

它们已经不同步,如下图所示:

enter image description here

注意一些提交是相同的(当我在另一个用户的新提交时,我推送到私有)

我如何解决这个问题,以便两个遥控器处于完全相同的状态?

如果可能,我想保持工作仓库版本历史记录清洁(没有合并提交等)。

正在运行git remote -v

origin  https://internal-work-host/repo.git (fetch)
origin  https://internal-work-host/repo.git (push)
private https://private-external-host/repo.git (fetch)
private https://private-external-host/repo.git (push)

1 个答案:

答案 0 :(得分:0)

您必须将代码推送到远程存储库。

// Switch to local master branch
git checkout master

// Merge the remote branch into your local branch
git pull origin master

// Now push the combination of the 2 to the remote 
git push origin master

现在两个分支都包含相同的代码

相关问题