使用git完成此操作的最佳方法是什么?在一次提交中将master从一个存储库合并到另一个存储库的主文件
我正在创建一个私有存储库,并希望能够定期合并来自另一个公共存储库的更改。但是,为了保持我的私有存储库提交历史记录清洁,我不想引入公共回购的所有提交,但能够在一次提交中解决任何和所有更改。
的什么,我试图做例子:
我初始化我的服务器上的存储库,myrepo.git
git init --bare
我克隆此本地,
git clone [email protected]:myrepo.git
然后继续在master
分支上进行初始提交。
然后我修改我的混帐配置,这样我添加的公共仓库作为新remote
[remote "origin"]
url = [email protected]:myrepo.git
fetch = +refs/heads/*:refs/remotes/origin/*
[remote "public"]
url = http://github.com/path/to/publicrepo.git
fetch = +refs/heads/*:refs/remotes/origin/*
做一个git merge -X recursive -s ours public/master
将是有意义的我要什么,我试图完成,但我得到的以下:
(master) $ git merge -X recursive -s ours public/master
merge: public/master - not something we can merge
不过,如果我执行git pull public master
,将继续拉动每一个承诺从public
回购到master
上myrepo
,结尾:
commit 421b15b37efacb84be80b95c8534087e67835017
Merge: be1a905 831a27d
Author: Me
Date: Sun Feb 23 23:04:29 2014 -0500
Merge branch 'master' of http://github.com/path/to/publicrepo into master
这个公共回购有很多提交,它是根本不可行的压扁他们。
如果可能,我希望看到的master
提交历史每次我解决myrepo
合并对public
冲突时间Merge branch 'master' of http://github.com/path/to/publicrepo into master
一个提交上myrepo
。
是否可以这样做,还是有一个更简单的方法?
谢谢,好点的一切。 – Scott