2015-12-13 209 views
2

场景:如何让两个git仓库相同?

我有两个git仓库,分别叫volatiletemplate

template是一个只读回购,被视为“原始”。 (至少两个)上游遥控器上都存在volatiletemplate

volatile作为template的相同副本开始。 这是通过力推到volatile从内template做像这样:挥发性

cd template; 
git push -f remote-url1:volatile --prune 
git push -f remote-url2:volatile --prune 

经过几次操作,挥发的状态发生变化。 添加分支,标签和提交。

我该如何着手使volatiletemplate(在遥控器上)一致?


我现在可以重置通过执行分支下面:

# On my local machine 
cd template; 
git push -f remote-url1:volatile 'refs/remotes/origins/*:refs/heads/*' --prune 
git push -f remote-url2:volatile 'refs/remotes/origins/*:refs/heads/*' --prune 

我使用

cd template; 
git push -f remote-url1:volatile --tags --prune 

cd template; 
git push -f remote-url1:volatile --prune 'refs/tags/*:refs/tags/*' 

,以消除添加的标签试图遥远的,但这似乎给混合resul TS(我不能在时间删除标签,远程说的一切是最新的)

+0

你能简单地'混帐克隆远程URL1:模板volatile'? –

+0

@JohnZwinck我在本地做到这一点,但我无法为遥控器做到这一点。 – ffledgling

+0

你可以rsync到遥控器吗? –

回答

0

到目前为止,最好的办法似乎是:

cd template; 
git push -f remote-url1:volatile 'refs/remotes/origin/*:refs/heads/' --prune 
git push -f remote-url1:volatile '+refs/tags/*:refs/tags/*' --prune