Skip to content

GitHub repositories

tomkraljevic edited this page Dec 4, 2013 · 6 revisions

THIS PAGE IS OBSOLETE

Private repositories

General strategy

Each private repository should be created as a duplicate of public repository. See: https://help.github.com/articles/duplicating-a-repository

Lets say the customer is called jahoda then the repository should be called h2o.jahoda.

git clone --bare git://github.com/0xdata/h2o.git
cd h2o
git push --mirror git@github.com:0xdata/h2o.jahoda.git

--mirror parameters makes a new repository as a duplicate of the original repository

Each private repository contains a master branch and customer branch called jahoda. The master branch contains the mirror of public master branch, customer branch contains customer specific code.

# create a new local repository
git checkout -b jahoda
# ... make customer changes ...
# and push changes into a new remote branch
git push origin jahoda

How do I integrate changes from public h2o repository into customer repository ?

  1. add read-only remote (read-only because of used URL kind) called public
git remote add public git://github.com/0xdata/h2o.git

To list remotes use git remote -v, to inspect a remote use git remote show origin

  1. fetch all changes from public remote
git fetch public
  1. merge incoming changes from public repository into master of customer repository
git checkout master
git merge public/master
git push 
  1. OPTIONAL merge changes in master into customer branch jahoda
git checkout jahoda
git merge master

How do I back-port changes from private branch into public master?

  1. Think about that - this step is DANGEROUS since you can introduce a code which is customer-specific into public branch !!!!
  2. Think again !!!
  3. Find a commit which you want to back-port and find its hash
  4. Cherry pick a commit into master at customer repository. Cherry-pick directly commit the change, if you want to avoid commit use -n option
git checkout master
git cherry-pick deadbabe0101
  1. Push change into public h2o master. This will not work, since above we used read-only URL of public H2O repository (the skilled user knows how to edit .git/config and change it :)
git push public master

Recommended code changes for customer repositories

  • edit .project and change <name>h2o</name> to <name>h2o.jahoda</name>
  • separate all new customer sourcec into src-custom - it should symplify change tracking
  • ?more?

References

Clone this wiki locally