Thursday, February 12, 2009

Branching after committing locally in git

Today I found out that one of my co-workers had a local commit that he wanted to undo, so that he could work on another task that he actually wanted his earlier commit to come after. His question was: How do I undo a commit but keep the files? The answer to that is simple: simply use git reset HEAD^ to point master to the commit before the current HEAD. By default, this leaves the checked out code alone, and it remains as uncommitted changes locally. git reset --hard will check out the previous changes and blow your commit away completely.

On the other hand, branches in git are essentially just pointers to nodes in the repository tree. So, consider doing this instead:

  1. git checkout master
  2. git branch new_branch
  3. git reset --hard HEAD^
What does this do? It creates a new branch that points to the HEAD of the current master, then resets master to point to the previous commit from HEAD. Once that's done, you can continue working in the branch, or make further commits to HEAD. Then, when you're ready to continue work in new_branch, you can rebase it against master and continue on your way as usual!

Sunday, February 8, 2009

Gaming Lunches at AT&T Interactive

I started a new job as a Ruby developer at AT&T Interactive (AKA in Glendale, CA, back on December 1st. While I've organized gaming lunches at my previous two companies, I've always been a little bit conservative, worrying about being too successful and not being able to handle too many participants. Ha!

Well, having too many participants is a problem I'd love to have. So, I decided to go all out on this one. I worked with HR to send out an allstaff email to get participants. I made up fliers with pull tabs giving the e-mail address to contact to join the mailing list. I hold the gaming events in the main break room, which has room for plenty of people. And I'm varying the games played from week to week so that we'll cover a wide variety of choices, and hopefully we'll bring more people out because of it.

So far, we've played Scrabble, Rummy, and Chess. Scrabble had the best turnout so far: 8 people. Chess was close, with 7 players. This week we'll be playing Hearts.

I have 35 people total on my mailing list so far, and hopefully I'll be able to build the events and get more regular players. These kinds of events need to reach a critical mass before they can be self-sustaining. The group has to be big enough to be able to lose a couple of people here and there and still have at least 5 or 6 attendees every week.

I'll be updating with my status periodically. Have you ever organized an event like this at work? I'd love to hear from you!