Thursday, May 01, 2008

Trying to get Git

I'm trying to patch some stuff in the java-memcached-client right now. The code is hosted at GitHub. I've never used Git in my life so this is a brand new experience for me. Boy did I screw this up :P
I've got branches gone wild and accidental reverts. I think I'm starting to get the hang of it now though. Thanks to this cheat sheet, and this tutorial.

1 comment:

dustin said...

Nah, I've seen and done much worse. Some of the nice things about git are the ways it allows you to make temporary mistakes, but correct them before you publish.

The reflog allows you to restore pretty much any committed state of your tree over the last three months. That means you should be encouraged to commit ugly code or changes and then reset or rebase them away before anyone sees. Sometimes, I'll commit code I very much don't want just because it kind of works and if I can't make anything better, I can dig it out.

Rebase (--interactive) allows you to take all of the commits you've done that led you to a working state and reorder/rewrite/remove/combine them so that you have a tree that looks like you want it.

It's a little annoying for people using your tree to be rewriting stuff they're referencing, but you have this great stop-gap between writing some code and releasing it to make it look like you understood what you were doing all along (and for most of us, that's all lies).