Having a private public repo affiliate on GitHub?

I have an open PHP project in the GitHub repository that contains only one branch (master).

I want to have a separate / fork branch which is private for me (I paid for private GitHub repositories). I would like to be able to merge the changes from the private / fork branch to the public repo and vice versa.

With that in mind, here are my questions:

  • Can I have a private branch in a public repo?
  • Can I open my own public repo in my own private / fork branch?
  • If both of the above are possible, is this the best way forward? If not, how should I continue?
+99
git-branch github fork
Nov 02 '11 at 15:45
source share
3 answers

Is it possible to have a private branch in a public repo?

On GitHub, your repository is public or private; you cannot selectively "privatize" only a branch.

Is it possible to convert my own public repo into my own branch / fork?

You can clone your public repo to your local computer, if necessary, a branch, and just do not git push origin master "private" branches upstream (specifying which branch should push to the beginning: git push origin master or git push origin branch-i-want-to-be-public:master ).

What is the best way forward / how should I continue?

To take advantage of GitHub for your public and private development, I would suggest expanding your public branch on GitHub by changing the settings of the new plug to "Private" and then cloning the personal version to your local machine. When you're ready to post the changes, drag everything down to your private fork on GitHub, and then use pull requests to selectively copy branches to a public repo.

To make the repository private on GitHub, you must have an updated (paid) account. If you are just swinging a free account, you can still use the first process that I suggested: - clone the public to the local machine, branch and push certain "public" branches to the origin - without the need for a private repo.

If you have a paid GitHub account or use another service that offers public and private forks and transfer requests (for example, BitBucket ), then you can use any of the above methods to make your code public.

+89
Nov 02 '11 at 16:01
source share
  • Duplicate your repo .
  • Make duplicate repos private on GitHub.
  • Cloning a private repo on your computer.
  • Add remote access to your public repo (git remote add public git @ github.com: ...)
  • Push the commit branches dedicated to your public repo to this new open remote. (make sure you don't accidentally commit closed source code)
  • You can make changes to your public repo using "git fetch public", and then merge them locally and click on your personal repo (source remote).
+42
Jan 09 '13 at 17:53
source share

1.) Is it possible to have a private branch in a public repo

From what I know, no.

2.) Can I remake my own public repo into my own private branch

No, you cannot deploy a full repo (1-n branches) to one branch. Well, actually you could if you just forked one branch of a complete repo. Just add it as a remote or start with a clone.

You may also be interested in Rare Checks .

3.) If both options are possible above, which is the best way forward

n / a

4.) If not, how should I continue?

n / a

+1
Nov 02 '11 at 15:48
source share



All Articles