只将一些提交推送到另一个git存储库
我有两个远程origin
和another
存储库,例如,提交源的历史记录origin:master
repo:
A - B - C - D - E - F
another
是空回购。
只需要将最后两个提交E - F
提交给another:master
即ie:
origin:master: A - B - C - D - E - F
another:master: E - F
在推出这两款遥控器之后,我如何能够做到这一点?
你需要一个初始空提交和两个分支的git历史记录:一个(你当前的master
)指向F
,另一个指向空提交。
检查指向空提交的分支, cherry-pick
E
和F
,并将此分支推送到another
远程。 当您在another
存储库中进行更改时,您只需简单地将它们cherry-pick
即可。
所以,在创建了初始提交之后:
git checkout -b another-branch <<SHA of empty initial commit>>
git cherry-pick <<SHA of E>>
git cherry-pick <<SHA of F>>
git push another another-branch
链接地址: http://www.djcxy.com/p/49823.html
上一篇: Push only some commits to another git repository
下一篇: Push specific commit on the remote branch tracking the current branch