Skip to content

Developing webERP Using Github

Phil Daintree edited this page May 14, 2018 · 3 revisions

Developing webERP - maintaining a fork and submitting improvements

Andy Couling has written a much more eloquent and complete guide on the wiki here

First Create Your Personal Fork of webERP

To create a fork of webERP for use in your business and to keep track of your changes (and potentially give improved code back to webERP) you first create your own GitHub login - then browse back to:

https://github.com/webERP-team/webERP

Click the fork button as show below:

GitHub Fork

The fork creates a copy of the webERP repository as it is now to your own repository.

Making your own changes

If your GitHub login is "JoeCool" then browse to your GitHub page:

http://github.com/JoeCool

Click on your webERP repository that you created in the first step above, and then click on the "Clone/Download" button and then click the copy button to copy the URL to your repository.

Now on your development machine (with git installed) in a terminal window change to the directory where you wish to create the working copy of your webERP repository for development. It makes sense to have the webERP code under your web-root directory so that you can test any changes you make in a browser on the same machine with http://localhost/webERP - e.g. My web-root directory is /var/www/html

I had to add my user phil to the www-data group (your web-server user group may be different) and then add permissions to the downloaded files to allow the members of the group to have write access. (sudo chmod -R g+w webERP)

Then to clone the webERP git repository to this directory, at the Linux command line use the git command:

$git clone https://github.com/JoeCool/webERP.git

This downloads the git repository and makes a working copy on your machine under the current directory.

Making Changes to the code

On your development machine you can edit the code at will. Then review the differences with

$git diff

This is a bit convoluted I think as there are now several stages to get the changes up to your repository. First you must commit all the changes to your local repository

git commit -am 'Some message describing the changes'

Where 'Some message describing the changes' is a description of your changes Then you "push" the changes up to your github repository with:

git push

Then to get the changes on your repository included in the main webERP/master branch you need to submit a "pull request" by going to the http://github.com/webERP-team/webERP.git page

Getting updated code from webERP-team/webERP repository into your forked repository

When webERP developers add new functionality to the code you can keep your fork in sync with the webERP code by fetching the latest webERP code and merging back into your code. GitHub reports on your fork if there have been commits to the webERP-team/webERP/master repository from which your fork was created in the GitHub web interface.

To get the latest changes/commits, at the Linux command line use the git command:

$git remote add upstream https://github.com/webERP-team/webERP.git

The "add upstream" command only needs to be done once to make the upstream repository the webERP-team/webERP repository.

Then whenever you wish to get the latest webERP-team/webERP bug fixes/new developments, at the Linux command line use the git command:

$git fetch upstream

The newly fetched code then has to be merged with the code in your repository/branch - assuming your branch is called master to perform the merge, at the Linux command line use the git command:

$git merge upstream/master

The upstream webERP-team/webERP/master code will then be merged with your local repository on your development machine - to push this back to your github.com repository:

$git push

You will be prompted for your github username and password. This can get tiresome and the answer is to configure git to use a "credential-helper" I use gnome-keyring - google found me at https://blog.scottlowe.org/2016/11/21/gnome-keyring-git-credential-helper/