Question

I currently have a private git repo, and I'd like to create a public repo synced with a single branch of the private repo. These are my requirements:

  • don't include the entire history of all commits made to the private repo
  • easily push updates from the private repo to the public copy

I tried the mirror option as outlined here, but it copied all branches and also included all previous commits.

https://help.github.com/articles/duplicating-a-repository

Was it helpful?

Solution

You could have 2 upstreams set in your local directory. Sort of similar to how you'd have a forked-repo set up. here's an example

$ git init
$ git remote add public https://username@github.com/username/public.git
$ git remote add private https://username@github.com/private/private.git
$ git pull private the-branch
$ git add -A
$ git commit -m "moving private to public"
$ git push --set-upstream public master
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top