All the cool kids are using Git

Yes, it used to be true that all the the cool kids were using darcs. Darcs is so 2005, though, so I've decided to take Git for a spin. Here's what I'm enjoying the most so far:

  • git-citool is a very cool GUI for picking what changes you want to commit, write the commit message, commit, push to a remote repository, and more. I love this little application. It lets me go through my changes in any order, go back to Emacs and fix any mistakes without losing my commit message or the list of changes I've already marked for commit. Love it.
  • gitk lets me visualize the repository history. All the patches, all the branches, all the diffs, all the commit logs, easily accessible within a few clicks. It's quite fast too.
  • Another useful feature git-citool has is a history browser that lets me browse my repository and see each file's history, which patches change which lines, navigate through the various past states of a file, etc.

And, of course, Git has all those great characteristics of a distributed VCS. I've missed some things from Darcs though:

  • For smaller changes I prefer darcs record over having to reach for the mouse with git-citool and git-add -i isn't as nice.
  • darcs revert allows me to revert individual hunks within a file, with a nice interface too.
  • darcs unpull and darcs unrecord allow me to get rid of patches without having to generate a reversion patch (which is what Git does if the patch you want to revert is not the very latest patch). Also, they keep any local changes untouched.
  • darcs pull lets me pull only the patches I want from another repository. I haven't found a way to do that in Git.
  • Darcs's no effort spontaneous branches are a joy. No need for explicit branch creation. You just create copies of your trees and move individual patches around whenever you feel like doing so. This way you can easily, say, merge only some of the changes from one branch into another, quickly discard a branch, etc.

Darcs has well-known performance issues, I've watched it sit forever trying to apply some patch. This hasn't been a great problem for me with the small projects I usually work on though, so I don't really regard that as a bit advantage of Git's.

For me, it's the tools. I have moved some of my stuff over to Git but I still like a lot of aspects of Darcs's workflow. Perhaps some more experience with Git will change my mind, or perhaps Darcs-Git will be the VCS really cool kids will be using in the future. We'll see.

If you're interested in trying Git out, have a look at Git For SBCL Hackers and Everyday GIT With 20 Commands Or So.


#lisp tip of the day

Ever recompiled a function hoping to fix some bug only to find out nothing changed? Perhaps you passed #'some-function around and your live code is still dealing with the old definition? How to tell? Here's an example with SBCL:

* (values (symbol-function (defun foo ()))
          (symbol-function (defun foo ())))

The old version is printed with its object identity (#x11e47cdd in this example), whereas the current global definition is printed without it allowing you to quickly tell which is which. This behaviour is not standard but, for example, OpenMCL provides similar information:
? (values (symbol-function (defun foo ()))
          (symbol-function (defun foo ())))
#<Compiled-function FOO (Non-Global)  #x85AE40E>
#<Compiled-function FOO #x85ADB06>
Your favourite Lisp might also do something along these lines. Great tip by Xof.