如何从第二个 github 存储库中提取提交? (为了分离提交历史)
我需要雇用一些自由职业者,但不允许他们看到以前的提交,而只能看到当前的状态。因此,我想在我的 github 上克隆一个私有存储库,删除 .git 提交历史记录,将克隆存储库作为公开添加到 github 帐户,让自由职业者分叉该存储库并发送带有更改的拉取请求。然后将更改连同我的整个提交历史记录拉回我的原始私人存储库。
最好的方法是什么?谢谢
I need to hire some freelancers but not allow them to see previous commits, just the current state. So Id like to clone a private repo on github of mine, remove the .git commit history, add the clone repo to the github account as public, have freelancers fork that repo and send pull requests with their changes. Then pull the changes back to my original private repo with my entire commit history.
Whats the best way to do this? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不认为您能够将更改一直拉回具有完整历史记录的私人存储库,因为您希望公开- repo 和 private-repo 有效地具有不同的根提交。
我认为您最好的选择可能是:
git format-patch
,私有存储库中的git am
gitcherry-pick
单独提交git rebase
添加到您的私有分支上;在尝试此操作之前,您可能应该非常了解 Rebase 的工作原理。I don't think you'll be able to pull the changes all the way back to your private-repo-with-full-history, because you want the public-repo and the private-repo to effectively have different root commits.
I think your best bet might be:
git archive
.git format-patch
in the public-repo,git am
in the private-repogit cherry-pick
individual commitsgit rebase
your public branch(es) onto your private one(s); you should probably have a Very Good Understanding Of How Rebase Works before trying this.