OpenXPKI GIT Collaboration Example

This example explains how a collaboration with GIT during the development of an HTML frontend for OpenXPKI can work.

Naming conventions

1. Branch: master
The subversion tree will always be the master branch of the GIT repository to avoid any confusions.
2. Branch: html-local
The local development snapshot is called html-local. This branch is your working copy which you use to develop the HTML interface.
3. Branch: html-public
This is the branch which will include the changes which you want to publish. A good example is the HTML login component. If you finished your work at a special login component then you must merge these changes from the branch html-local to the branch html-public.
4. Branch: html-bellmich / html-martin
If you want to download the latest changes from the user bellmich then you must connect to its public GIT repository and download its branch html-public into the local branch html-bellmich.

General Tips

Sometime this section is called warning. So please read it carefully. Otherwise you will need some time to fix the resulting problems :)

First html-local and all other names are only names. You can choose the your own names of course but it is helpful to first discuss with your development partners which names you make public because it is really difficult to talk about problems if the naming conventions are different.

Second always only edit on html-local or however you you call this branch. Never use the master branch to implement or test something. The master branch is only for commiting to SVN.

Third if you are a beginner then always use "git commit -a" to be sure that you don't forget something.

Fourth if you decide to do something with the svn (escpecially if you call update or commit etc.) then switch to the master branch and run "svn diff" and "svn status" before you do something.

Common Workflow

Setup SVN

  mkdir test_svn
  cd test_svn
  svn checkout https://bellmich@svn.sourceforge.net/svnroot/openxpki

GIT env

  vi ~/.bashrc
      export GIT_AUTHOR_EMAIL="johndoe@example.com"
      export GIT_AUTHOR_NAME="John Doe"
  cd test_svn/openxpki
  git-init-db
  echo "*.svn" >>.git/info/exclude

Setup branch master

  git add trunk
  git add www.openxpki.org
  git commit

Create a new branch

  git branch                 # show all available branches
  git branch html-local      # create new branch
  git checkout html-local    # switch to branch html-local

Publish a new branch

Note you can publish from html-local too but then you cannot hide local changes from publishing.

Commit changes to a branch

  git commit  ## sometimes it is necessary to use -a

Publish changes to a branch

  git checkout html-public
  git pull . html-local
  git commit
  git push html-public

Download a new branch

  vim .git/remotes/html-martin
      URL: http://www.cynops.de/oss/OpenXPKI/openxpki.git/
      Pull: master:html-martin
  git fetch html-martin

Update a downloaded branch

  git fetch html-martin

Merge changes from a downloaded branch

  git checkout html-local
  git pull . html-martin

Merge changes to master branch

  git checkout master
  git pull . html-local
  svn diff
  svn commit
  git commit
  svn status

Other useful examples

Finally there is a good documentation with examples by the Wine project: http://wiki.winehq.org/GitBranches.