Monday, March 15, 2010

Git Achievements

This weekend I created a little application called git achievements. Similar to the XBox360 Achievements you can unlock all sorts of Achievements while you use git. It brings a bit of fun (and bragging) to those who use or who are learning git.
Almost all of the git commands have achievements of different levels (depending on number of times a command is used). For example you can become a "Apprentice Author" after only two commits, "Author" after sixteen and finally a "Master Author" after 128 commits. Various other Achievements can be unlocked just be performing an action such as adding a .gitignore file or setting your user name in git config. When you unlock an achievement you will get a message on your console showing the new achievement like so:
Git Achievement Unlocked!

Added a .gitignore file to a repository.
Having collected all of these achievements you can set a git config flag and have it automatically publish your achievements to your github pages. The published page includes a list of all of your unlocked achievements, total points as well as a list of achievements that are still locked. I have my git achievements published so you can checkout the full list of achievements.

Installation is a snap, after forking and cloning the repository just add git-achievments to your path and alias git=git-achievements.

Creating this was a lot of fun. It was simple and a bit silly. After getting the idea I had something working in no time at all. It was fun coming up with the different names for the Achievements and as I was working on the project unlocking them. Originally I had only planned to create the output to the console, but it only took a few minutes to realize just how easy it was to publish to GitHub Pages which brought the achievements to a whole fun new level. Achievements in video games often causes the user to explore parts of the game that they might not have and often cause them to learning actions that they might otherwise ignore. I am not sure if git achievements is very useful as a learning tool, but it is fun to have installed and popup with a new achievement now and then. If there is a trick in Git that you think other people don't know about or should learn let me know (or send me a merge request) and i'll make a new achievement for it.

Photo by terren in Virginia under the cc license.


Zach Peters said...

This looks like a lot of fun. Thank you for creating it!

seriousken said...

Does it work retroactively? ;)

Corey Haines said...

Great idea! Could it be integrated as hooks, rather than replacing the git command-line?

Benjamin Meyer said...

Many of the achievements don't interact with the hook system at all which was why I went for just overloading the git command. For example the one that is achieved when you do git config --global or when you run git log.

Benjamin Meyer said...

@seriousken, you could probably write a script to retroactively import a bash history without too much work.

Christoph said...

After an achievement is unlocked, I see:
sed: -: No such file or directory
sed: -: No such file or directory
Adding new achievements and publishing to origin.

It seems to work anyway, but that's probably not good anyway. :)



Christoph said...

Also, maybe related, the page shows a total of 0 achievements:

Benjamin Meyer said...

@Christoph: Fixed the sed issue which should fix your page generating.

Christoph said...

Thanks, that did the trick!

pyro2927 said...

I get an error when trying to push my achievements:

usage: dirname path
cat: git-achievements: No such file or directory
fatal: Not a git repository (or any of the parent directories): .git
Adding new achievements and publishing to origin.
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git

Any ideas? This is really cool and I'd love for it to work

Jacob said...

Pretty nifty project! However, it seems like storing the git-achievements script, and the generated achievements (HTML, and RSS) all in the same repo/branch would make it difficult for people to collaborate on it.

zino said...

Brilliant! Please continue to develop this.

bearontheroof said...

Bring on the Facebook Connect integration! :D

Tor Arne Vestbø said...

Great idea :)

Popular Posts