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:
-
Login to GitHub
-
Fork the project at https://github.com/qgis/qgis by clicking “Fork”. This may take a while
-
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.
-
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.
-
Now fetch from upstream: git fetch upstream
-
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
-
You can go to your repo on GitHub and you should see your commit message from the push
-
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.
-
Fill in a title and message for the request, review the commit(s) and file(s) involved and when satisfied, click “Send pull request”
-
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:
- GitHub Help: http://help/github.com
- Forking: http://help.github.com/forking/
- Pull Requests: http://help.github.com/pull-requests/