This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Learn » eZ Publish » How to contribute to eZ Publish using...

How to contribute to eZ Publish using Git

Tuesday 01 March 2011 10:07:20 pm

  • Currently 5 out of 5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Some notes on rebase

When you work towards one branch it is perfectly fine to use “$ git pull --rebase” before you push to avoid unneeded merges. But not when you work towards a public topic branch that tracks another branch (master in the cases described above), as it will rewrite history of your topic branch causing issues for everyone else who uses it as well as losing relevant history when the topic branch is merged back to master.

So only use it optionally on topic branches before you push the first time, otherwise it’ll do more damage than good.


Merging an ‘alien’ topic branch

In the following example we merge code from one eZ Publish fork, to our own. The same approach is used when eZ Engineers merge an external topic branch into eZ Publish, ( if Github’s GUI functionality of directly accepting a pull request is not used ). If not already done, we need to add remote to the fork we want to take a look at.

$ git remote add <user> git://<user>/ezpublish.git
$ git fetch <user>

Assuming you have already checked out the local branch you would like to merge the changes into using “$ git checkout <branch>” we can now merge the topic branch using:

$ git merge --no-ff <user>/<topic-branch>

Working with Git patches

There are predominantly two main paths for creating patches in our workflow, not including regular diffs. The first way, is to use git’s format-patch command. This command will take the commits you specify, and save them out as mbox compatible files. These files can then be passed on to another developer, or attached the issue tracker. The good thing about a git patch is that it retains author information, date and commit message from the original contributor, allowing for a correct attribution of work (git can distinguish between the author of a patch and its committer). This command has a lot of options, please see the git help, for more details here.

$ git format-patch <sha1(commit-hash)>

So if you have received a patch, reviewed it, and would like to add it the repository, you can use the am command. It takes a patch produced with format-patch and commits it to the repository, with all the information intact, provided the patch still cleanly applies.

$ git am <patch file> [<patch file>] [<patch file>]
36 542 Users on board!

Tutorial menu


Printer Friendly version of the full article on one page with plain styles


Proudly Developed with from