Contributing to QGIS Using Git

One of the challenges in any open source project is accepting contributions from people that don’t have, need, or want access to your centralized source code repository. Managing repository accounts for occasional or one-time contributors can be come a bit of an administrative issue. To date, the QGIS project has accepted one-time or occasional contributions through patches submitted via a help ticket.

To make it easier for you to contribute to QGIS, we have created a clone of the Subversion repository on GitHub. This allows you to “fork” the QGIS repository and have your own local copy of the source code. Through GitHub you can easily submit your enhancements and bug fixes for inclusion in the Subversion repository.

You will need to install git on your computer and create a GitHub account. Once you have done that, here is the process for creating your working copy and contributing to QGIS:

  1. Login to GitHub

  2. Fork the project at https://github.com/qgis/qgis by clicking “Fork”. This may take a while

  3. Create a working copy, replacing g-sherman with your GitHub name: git clone git@github.com:g-sherman/qgis.git This will also take a while, depending on the speed of your network connection. My clone downloaded 162 Mb from GitHub.

  4. Change to the directory containing your local clone and add a reference to the original QGIS repo: git remote add upstream git://github.com/qgis/qgis.git This gives you are reference named upstream that points to the repo you forked.

  5. Now fetch from upstream: git fetch upstream

  6. Now you are ready to work with QGIS. Make your changes, commit them, and then push back to your fork on GitHub: git push origin master

  7. You can go to your repo on GitHub and you should see your commit message from the push

  8. Now you want to tell the QGIS developer team there is something they should look at. You do this by issuing a pull request by clicking on the “Pull Request” button on your GitHub QGIS fork page.

  9. Fill in a title and message for the request, review the commit(s) and file(s) involved and when satisfied, click “Send pull request”

  10. Now sit back and wait for someone to review, comment on, and hopefully merge your request into the QGIS repo.

To keep in sync with the QGIS repo, use git fetch upstream git merge upstream/master

Make sure to check out these resources for help and more information on working with repositories on GitHub: