archives 2008

Git Tips #1: Get there now

Sometimes you’ve played around in the history of a branch, edited some stuff in older commits, perhaps reordered them. You’ve reset’d back a few commits, and now you want to get to the final state you were at initially (or whatever state you want to get to).

Say you’ve kept a branch called “the-end-state” with the working end state you wanted to get back to before you started messing around with the history. You don’t want to merge (merging two alternative histories of the same development wouldn’t make any sense), you don’t want to rebase (it’s about building a new history, not forwarding it on top of the old one). You just want a new commit to bring you to “the-end-state“.

And you want to get there now!

The intuitive way to do this is the following:

$ git diff ..the-end-state > finish.patch
$ patch -p1 < finish.patch
$ git commit -a -s

But why three steps when you can do with just two, using git read-tree to import the tree from “the-end-state” branch into your index (-m to check for unmerged entries) and populate your work tree (-u):

$ git read-tree -m -u the-end-state
$ git commit -a -s

Thanks Junio for the tip on gitml!

Technology-dedicated insomnia

Just opened this new blog at bytes.inso.cc to host ramblings and thoughts and tips about computer-related stuff. The idea is to stop scaring my grandfather, who does read my regular blog, and start posting more regularly about XMMS2, Git, mindmaps, the power of syndication feeds, crappy/genius UIs, Information Architecture, Human-Information Interaction and other such trendy buzzwords.

And perhaps it will encourage others to blog more regularly on the XMMS2 Planet!

So, stay tuned…