We recently launched geocommit.com. Geocommit is a service to add geolocation data to your commits. You only need a working WiFi connection. No GPS module is required.
This blogpost gives you an example how to use geocommit and the geocommit.com services. I’ll show how to use geocommits in your Git or mercurial project. How to make github and bitbucket more beautiful with our Chrome and Firefox extensions and how to get a fancy map of your geocommits.
What is geocommit
First of all, geocommit is a text format to attach geolocation data to version control system commits. The geocommit website has detailed information about the geocommit format.
Second, geocommit is a service to store and analyse your geocommit data. We offer a set of tools and a webservice to make geocommit cool. The Git implementation git geo runs on Mac OS X and Linux. The Mercurial implementation hg-geo runs only under Linux. Mac OS support is under way.
Git & Geocommit
To start with geocommit, install git geo:
$ pip install geocommit
Go to a project directory and enable geocommit support:
$ cd myproject.git
$ git geo setup
Installing geocommit hook in /home/dsp/awesomeproject/.git/hooks/post-rewrite
Installing geocommit hook in /home/dsp/awesomeproject/.git/hooks/post-merge
Installing geocommit hook in /home/dsp/awesomeproject/.git/hooks/post-commit
This will enable geocommit support in your project. If you commit something with git commit, git geo will try to get your current location and add a geocommit. If no WiFi connection is enabled, no geocommit will be created.
Check your geocommits:
$ git log --show-notes='geocommit'
Merge: 25cf72d 828af6e
Author: David Soria Parra
Date: Tue Jan 4 14:00:55 2011 +0100
Merge branch 'master' of https://github.com/jezdez/geocommit
Let’s push our geocommits to github:
$ git geo push
git geo push accepts the same options as git push. It pulls geocommits first, merges them and then pushes geocommits and the given branch to the remote repository.
That’s everything you need. Easy, isn’t it? So let’s see how to enable geocommits on Mercurial and then talk about the Chrome and Firefox extensions.
git geo stores geocommits in git notes. We use the namespace geocommit
for that. Git notes have some cool properties. They are metadata and don’t change the commit hash. Therefore they can be added to a commit at anytime. They are displayed on github and can be deleted without any problem. You also can decide yourself when to push geocommits or not. You can delete already pushed geocommits without breaking the repository or changing any commit sha1. The drawback is that it is hard to deal with git notes from time to time. git notes is a new feature in git and not yet fully supported. We have to write a script to merge git notes as git notes merge is not available before git 1.7.7.
Mercurial & geocommit
You can add support for geocommits to Mercurial by installing the hg-geo extension. Clone the extension and enable it in your hgrc:
$ hg clone http://bitbucket.org/segv/hg-geo
$ echo "[extensions]\ngeo=/path/to/hg-geo/geo.py"
$ hg help geo
The extension will add an additional line to every commit that you do.
$ hg commit
$ hg log -v
user: David Soria Parra
date: Sun Jan 02 03:01:04 2011 +0100
Added tag v1.0.0 for changeset 3079e3ff3083
geocommit(1.0): lat 48.1211306, long 11.4853251, hacc 30.0, src nmg;
Now push your geocommits to bitbucket.
$ hg push
As Mercurial doesn’t have a way to store metadata, we are adding the geocommit data to the commit message itself. The obvious advantage is that you can use hg-geo with plain Mercurial. You do not need to enable hg-geo on the remote site to push geocommits (like Mercurial bookmarks). The disadvantage is that we modify the commit message and therefore the commit hash. There is no easy way to delete geocommits once they are created.
bitbucket.org and github.com
We can push geocommits easily now. But how to use them? We can install the Firefox or Chrome extension. This will display a map next to your commit!
To install the geocommit extension for Firefox you need Greasemonkey. Greasemonkey is a well know and supported extension that enables user scripts to safely modify the displayed website.
Install Greasemonkey from userscripts.org. You can then browse bitbucket.org or github.com and see a map of your geocommit:
On Chrome install the plugin from
We offer a post hook that you can use with github.com and bitbucket.org. Your commits will be tracked by gecommit.com and we will create a global and a project specific map as well as provide further analytics as soon as possible.
To install the hook go to th eadmin section of your repository and select Service Hooks.
Add http://hook.geocommit.com/api/github as a POST service hook.
Go to the admin seciton of your repository and select Services
Add http://hook.geocommit.com/api/bitbucket as a POST service hook
Thats about it. Browse www.geocommit.com/full.html to checkout your commits on our map.