开发者

How to pull in commits from a second github repo? (In order to separate commit history)

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开发者_如何学Go 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


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:

  • Take a snapshot of your repository with git archive.
  • Use that as the initial commit on your new public-repository (thus squashing the history).
  • Allow developers to fork, work and send pull-requests as discussed.
  • Copy the commits from the public-repository to the private-one using one of the following:
    • git format-patch in the public-repo, git am in the private-repo
    • Add both remotes, and git cherry-pick individual commits
    • Add both remotes, and git 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.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜