Submitting patches for Gpredict

From MyLabWiki
Jump to: navigation, search

This page provides some basic guidelines for submitting patches to the Gpredict code.


  1. Gpredict uses git for source code management and patches should always be submitted against the latest code in the master branch.
  2. Clean your code for whitespace errors (hint: git diff --check)
  3. Commit logically separate changesets, i.e. one commit per topic. Don't combine several topics into one patch and don't split one topic over many commits.
  4. Use meaningful commit messages. As a general rule, your messages should start with a single line that’s no more than about 50 characters and that describes the changeset concisely, followed by a blank line, followed by a more detailed explanation.
  5. If the changes fix a known bug or implement a requested feature, the ID of the bug/feature should appear in the first line.
  6. Work in a separate branch and create the patches using git format-patch -M origin/master. If not possible git diff origin/master will also be acceptable for small changes.
  7. Submit the patches to one of the following:
    1. If the patch fixes a known bug, submit it to the bug tracker.
    2. If the patch implements a requested feature, submit it to the feature request tracker.
    3. If none of the above apply, you can submit the patch to the general patch tracker or the Gpredict discussion mailing list.

Note that submitting a patch is no guarantee that it will be applied.

Example workflow

This section shows an example workflow for creating a patch according the the requirements listed above.

First, get the latest code from the git repository:

 $ git clone git:// gpredict.git
 $ cd gpredict.git

If you already have a copy pull the latest changes:

 $ git pull

Ensure that your name and email address is properly configured. If it is configured globally you're fine, if not you can configure it locally for gpredict:

 $ git config --global "Firstname Lastname"
 $ git config --global ""

Next, create a branch where you will be doing your work:

 $ git checkout -b mywork

When finished, check your code for whitespace errors:

 $ git diff --check

and commit your changes:

 $ git add file1 file2 file3
 $ git commit

Format the commit message according to the requirements. In case of small changes a 50 char or less one liner may be sufficient. In such cases you can use git commit -m 'My commit message'.

Before you create the patch, it is important to update your local copy to the latest code and rebase your changes accordingly:

 $ git checkout master
 $ git pull
 $ git checkout mywork
 $ git rebase master

This will replay your changes on top of the latest changes from master. See git help rebase for more information. If a conflict occurs during the rebase, it must be resolved before you can proceed.

When ready, create the patch(es):

 $ git format-patch -M master

This will create some nicely formatted patches, one patch per commit. Author information will be included in each patch.

Submit the patches at the appropriate place, see the last bullet of the requirements.