I haven’t looked closely yet, but this looks interesting: Write yourself a Git.
It’s not a joke, and it’s really not complicated: if you read this article top to bottom and write the code (or just clone the repository — but you should write the code yourself, really), you’ll end up with a program, called
wyag, that will implement all the fundamental features of git:init,add,rm,status,commit,log… in a way that is perfectly compatible withgititself. The last commit of this article was actually created withwyag, notgit. And all that in exactly 503 lines of very simple Python code.
Edit: here’s a related tutorial:
Build yourself a Distributed Version Control System (just like Git)