Question

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

Was it helpful?

Solution

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.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top