-
Notifications
You must be signed in to change notification settings - Fork 435
zArchive_GitPublicAndPrivate
The public repository is at psi4/psi4public.git. The private one is at psi4/psi4.git. We intend for the master branch to stay synchronized between these branches. The private repository only exists to allow for private branches to be developed before they are ready to be accessible publicly.
Occasionally a developer makes a change on the master branch of one repository (public or private), and the change needs to be propagated into the master branch of the other repository. This document explains how to do that.
Let's suppose we have a copy of the public repository, checked out using
git clone https://github.com/psi4/psi4public.git psi4
(If you are using ssh logins instead of https you would replace every instance of https://github.com/ in this document with git@github.com:).
We can set up access to the private repository (assuming the user has been added as a collaborator) using the following (the --tags
bit pulls tags from the remote:
git remote add --tags priv https://github.com/psi4/psi4.git
Now we can check what repositories we have access to using
git remote -v
This should print back the following:
origin https://github.com/psi4/psi4public.git (fetch) origin https://github.com/psi4/psi4public.git (push) priv https://github.com/psi4/psi4.git (fetch) priv https://github.com/psi4/psi4.git (push)
To make it easier to remember if origin refers to the public or private branches, we can create an alias to the public repository like this
git remote add pub https://github.com/psi4/psi4public.git
Now we can list the repositories with git remote -v and get
origin https://github.com/psi4/psi4public.git (fetch) origin https://github.com/psi4/psi4public.git (push) priv https://github.com/psi4/psi4.git (fetch) priv https://github.com/psi4/psi4.git (push) pub https://github.com/psi4/psi4public.git (fetch) pub https://github.com/psi4/psi4public.git (push)
Now everything is set up for us to access both repositories.
First, if you've made any changes, make sure to commit those. And if you're adding a tag, do it now
git commit git tag -a 0.2 -m 'CheMPS2 and setup improvements'
Then, you can synchronize the repositories just by pulling over any changes from both of them, and then pushing the changes back to both of them ("double-pull, double-push"). You must make sure to do this only for the master branch.
git pull pub master git pull priv master git push pub master git push priv master git push pub 0.2 git push priv 0.2