Reputation: 1133
I have been working on a private repository, where the project has initially been created with some sensible data. Now that I have enough content on the project I'd like to make it public on Github.
The work is still on-going and I'd like to avoid to maintain two different repositories.
From commit 29
everything would remain in sync (private and public).
This seems to be impossible based on the way Git works (cf. Based on this answer)
Could it be possible to fiddle around with the git hooks from my private repository to push to github ?
Managing a private and public remote with different histories
Import existing source code to GitHub
Resetting remote to a certain commit
Maintain a private and a public repo simultaneously using git branch with two different clouds
GitHub: How to make a fork of public repository private?
Upvotes: 1
Views: 304
Reputation: 4014
You can use an orphaned branch to achieve this:
# Suppose the tip of master has everything you want to start out as
# the initial commit in github
git checkout master
git remote add github <url to the project>
git checkout --orphan public
git push --set-upstream github public
Now effectively you have two repos in your local repo, pointed to by public
and master
. They are unrelated, so you won't be able to merge
either way. You can copy commits between them using cherry-pick
or patches however.
If you wish to continue to use master
for future development, simply do:
git checkout master
git branch master-archived
git reset --hard public
Upvotes: 5