From GIMP Developer Wiki
Jump to: navigation, search

This page describes how to create patches for GIMP. The instructions in this page also apply for GEGL and BABL. The content of this page is based on a mail sent to the gimp-developer mailing list from Eric Daoust (the original email can be found here)

Note: this is not a git tutorial, and it's barely a crash course. For a decent git tutorial, try reading git magic.

Required Tools

In order to work with GIMP's source (or GEGL, BABL), you will need Git, a version control system which is used for managing GIMP's source. The offical homepage of the git project can be found here.

Checkout the source

To checkout the source of GEGL/GIMP/BABL open the command line and type

git clone git://git.gnome.org/gimp destination-folder-name
  • If you want to checkout GEGL, replace gimp with gegl
  • If you want to checkout BABL, replace gimp with babl
  • Replace destination-folder-name with the name of the folder you wish to create to store the source.

Modifying the source

Create a local branch for your modifications:

git checkout -b branch-name origin/master
  • Replace branch-name with the desired name for your branch.
  • If you want to base your branch on a different branch than the master branch, replace origin/master with the name of the desired parent branch.

This branch will now contain your source. Do changes while on this branch, commit often (this will NOT affect other people's repository).

To see the status of your branch (which files were changed/added/removed) do:

git status

In order to have a graphical user interface to browse the current state of the branch, and to see the exact changes you made to specific files, do:


In order to commit your changes (i.e. save the current state of the source) do:

git commit -a -m "Message"
  • Replace "Message" with your own message, describing the current commit.

Note that if you have a long commit message (longer than 80 characters), then you should brake it into a summary line (of up to 80 characters) and description lines (directly after the summary) which describe the commit with more details (again, each of the lines should not be more than 80 characters long).

Finalizing your changes

When finished (and committed code one final time) do:

git pull --rebase

Fix any merge errors, re-execute your test code, and commit again if necessary (after finishing this, execute git pull --rebase again).

Creating a patch

To create the patch do:

git format-patch origin/master..branch-name -o output-folder
  • Replace branch-name with the name of your branch (if you forgot the name of your branch, type git branch to see which branch you are working on).
  • If you want to create the patch against a branch different than the master branch, replace origin/master with the name of the desired branch to create the patch against. Usually, you will only create a patch against a branch different than the master if your original branch was created against a different branch.
  • Replace output-folder with the folder where you want the patch files to be created. For each one of your commits, a patch file will be created in that directory (the patch files will be numbered by the order of the commits).

Now, when someone asks you to submit a patch, send him the files that were created in the output-folder you specified.