I'm about to start working on a open source project that will be hosted on GitHub. I want to make it open when it's "done" stable and I'm wondering what's the best approach for this.
Do I have to create a private repo and when I have my first release I create a separated public repo where I upload all the code?
I don't want to share all development history since there will be a lot of back and forth that make no sense to share.
答案 0 :(得分:3)
You can always use Bitbucket as a private repository and then clone it into Github whenever you're done (or even keep you project there).
Word of advice: projects are rarely "done" and never again touched. Also, if you'd like keep your history private, you can always rewrite your history and then push to that back to the remote. Not usually recommended, especially, if other people will be working on it apart from yourself, but that's always an option.
I would recommend just starting a project on Github and committing there. A lot of the projects have multiple commits. That's all part of the process, after all. Nothing's really ever perfect. :)
You can have a look at git rebase/squash.
答案 1 :(得分:3)
Keeping history
You can start your project on BitBucket with a private repo and push to this private repo. Then when it's finished :
git remote remove origin
git remote add origin https://github.com/username/repository-name.git
git push -u origin master
This way, you keep the exact same history when you push to the github repo (in fact, it's just an other remote repo for git).
Update: On the other hand, if you want to start fresh on github with a project without any history:
Starting fresh
.git
folder: rm -rf ./.git
git init
git add .
git commit -m "The project magically started here ;-)"
git remote add origin https://github.com/username/repository-name.git
git push -u origin master
That way, you'll have a repo with one commit at the exact state you left it, published on github.
Think about it before doing that, because a history can be very interesting to keep AND share ...
答案 2 :(得分:1)
You will have to pay if you want to create a private repo, see here for pricing details:
I would make it private at first, then just add another remote origin pointing to an empty public repository with your GitHub account. Then push to that remote when you are ready to make it public.
All GitHub repos are public by default.