Tuesday 01 March 2011 1:07:20 pm
This post will demonstrate Git using shell (command line). This is mainly because most of the visual GUI’s are not good enough yet at the time of writing (end of 2010, beginning of 2011), and they act fairly differently.
Documentation on installing Git for any platform (even Windows!) and setting up Github is best explained on Githubs excellent help pages: http://help.github.com/
There are also some useful links and comments on the earlier share.ez.no blog post: “eZ running on GIT”
If you would like to make some changes to eZ Publish like proposing a fix for a issue directly on Github, click on the fork button. This will create a fork of eZ Publish on your own account page (yes, this implies you created your github account beforehand. This is free).
Note: the fork will not update itself with changes done in the original repository, this is done by pulling in changes and pushing it to your fork ( how to do this is explained a bit below).
Using command line, go to the place you want to checkout eZ Publish in, for instance the localhost / www folder that your web server points to, to be able to execute eZ Publish directly for testing.
At this point there are two options:
Only do a clone of eZ Publish to track development, get source, potentially create patches and test (optionally specifying target <folder_name>):
$ git clone git://github.com/ezsystems/ezpublish.git [<folder_name>] $ cd [ezpublish|<folder_name>]
After that keeping your checkout up-to-date is a matter of :
$ git pull
If you want to checkout other branches than master, try to use the same name as remote branch to avoid issues when you later try to push changes somewhere. Eg. when you start following a branch (track):
$ git checkout -b stable-4.2 origin/stable-4.2
eg. When later checking out a local branch:
$ git checkout stable-4.2
If you are an external contributor that would like to make changes to eZ Publish and share it on github using the fork you created in “Forking eZ Publish” (optionally specifying target <folder_name>, and <user> as your github account alias):
$ git clone git@github.com:<user>/ezpublish.git [<folder_name>] $ cd [ezpublish|<folder_name>]
Now we need to add ezsystems as an additional read only remote location, in the following code examples we call it ‘upstream’:
$ git remote add upstream git://github.com/ezsystems/ezpublish.git $ git fetch upstream
Optionally we make master branch track upstream, making it easier to pull in changes:
$ git config branch.master.remote upstream
After that keeping your checkout up to date is a matter of:
$ git pull
If you want to checkout other branches than master, try to use the same name as remote branch to avoid issues when you later try to push changes.
eg. when you start following a branch (track):
$ git checkout -b stable-4.2 upstream/stable-4.2
eg. When later checking out a local branch:
$ git checkout stable-4.2
If you don’t want to make any changes to the code, you’re done! Just point your browser to
http://localhost/[ezpublish|<folder_name>]/ and you should get the setup wizard straight away given that you cloned eZ Publish lies into your www dir. No worries though, git folders are self contained so you can move it around as you wish (the whole cloned folder, not it’s sub-folders).