Categories
Computers

In Git, Branches Are Just Names

This was the mental leap of the day for me. A small leap, but a cool one (for me):

  1. Git represents commits in the repository as a Directed Acyclic Graph
  2. A branch in Git is just a pointer to a node in that graph.
  3. Master is just another branch and as such, it’s just a pointer into the graph.
  4. Once you’re done working in a branch and the work has been merged back into master, there’s no need to keep the branch label around. The story of how the commit happened is still in the DAG.
  5. “Deleting” a branch is really just removing that pointer into the DAG. Therefore, it’s safe to delete branches that have been merged back into some other line of development.

Whereas in the other SCMs I’ve used (Perforce, Subversion), branches are usually seen more as a copy of some set of a tree into a new namespace or directory. For example, in svn you generally cp your trunk into someting under /branches/, like /branches/awesome-feature, and then merge your changes back in later. If you then delete that branch to clean up your branches folder, you pretty much lose that hunk of history. Furthermore, svn doesn’t really deal well with the branched history when showing the change history for a file in trunk futher down the road. With Git and gitk, you can easily see the branch and merge points and figure out what changed when.

Advertisements
Categories
Computers

Linus on OpenBSD

Security people are often the black-and-white kind of people that I can’t stand. I think the OpenBSD crowd is a bunch of masturbating monkeys, in that they make such a big deal about concentrating on security to the point where they pretty much admit that nothing else matters to them.

–Linus Torvalds

I don’t really know the current OpenBSD folks well enough to agree or disagree, but it sure is funny.

Categories
Computers

Black Death: Installing XP over Ubuntu

I have an oldish ThinkPad (a T42p) lying around that I decided to use as an Ubuntu playground on for a while. I learned a lot playing with it, but now I do most of my Ubuntu-based work in a VM running on my fancy multi-core desktop, and Mandy could use a little portable Diablo II game machine, so today I went to reinstall XP.

After sticking the install disc in, I see the familiar "Setup is inspecting your hardware…" prompt and then… nothing. Just a black screen. Hard drive light is stuck on, the CD eventually spins down and nothing happens. /me scratches head.

After a bit of searching around, it turns out that the Windows XP setup program really doesn’t like it if you have odd partitions on the hard drive, where in this case, odd is defined as the default partition layout as set up by Ubuntu.

So, after a quick download of GParted and a wipe of the hard drive, the install is now cruising along, merry as can be.

Update: Thanks to Will for pointing out a Microsoft Knowledge Base article on exactly this subject.

Categories
Computers Food

Taking a Moment

I’ve been spending the last few nights reading Michael Ruhlman’s The Making of a Chef. I’ve enjoyed it immensely; I’d always wondered what it was like inside that campus after driving past it so many times in our weekend adventures northward from Tarrytown. Mandy and I never got the chance to eat at any of their restaurants while we lived downstate, but now we’re hopefully planning a trip south to sample the cuisine. Ruhlman is a pleasure to read and does a fantastic job conveying the passion and pressure of going through the Culinary’s course load. If you’re into cooking at all or want to know more about what it’s like to be inside the Culinary Institute of America (our other CIA), I heartily recommend the book.

Last night, as I was nearing the end of the book, I came across a scene that I’ve been replaying in my head all day. When you’re cooking in a professional kitchen, things move very fast and you have to come into it prepared and once there you have to be incredibly efficient to stay on top of all the orders coming in. When you get behind or overwhelmed, it’s called being “in the weeds.” While working at American Bounty, the premier restaurant at the Culinary and the last stop for the students before graduation, Ruhlman is working the grill station and another student is lost in the weeds. He’s getting behind and his station is getting messier and messier, enough so that the head chef asks him repeatedly to clean up his station. After a few such reminders, the instructor finally stops the student and tells him how he likes to get out of the weeds.

He takes a moment. He wipes down his station, getting it perfectly clean. He arranges everything he needs back into order, and this little restoration of order helps him clean up his mind as well. When you’re in the weeds, it’s as much a mental problem as it is a physical one. To perform quickly and efficiently, you have to be focused. The mess clouds your focus and that lack of clarity shows up in the final result.

This reminded me a lot of programming under a tight deadline. In the rush to get everything done and out the door, you tend to get messy. You don’t write tests, you don’t verify that code changes work in all the browsers, you check code in without actually compiling it first, and eventually the whole thing disintegrates. In your effort to go faster, you get sloppy and you end up slowing down.

So, a reminder to myself. When things get hairy, take a moment and clean everything up. You’ll probably get done sooner as a result.

Categories
Computers

Commands

My contribution to the meme:

blowery@hermes:~$ history 1000 | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
170 cd
78 ls
55 sudo
31 svn
18 scons
18 nm
12 less
9 grep
8 rm
8 make

As for why these, here are some rough guesses:

cd
obviously we use a lot of directories and I end up moving around quite a bit.
ls
implicitly tied to cd usage I think. And I have a lousy memory for what file names in what dirs.
sudo
This meme caught me while I was setting up a new working vm instance, hence all the sudo. Normally, I don’t think I use it quite so much.
svn
svn is our source control management tool of choice
scons
scons is our build tool of choice
nm
nm lists the exported symbols in a library. I was tracking down a problem with MySQL and a broken exported symbol during the aforementioned instance install.
less
less is my pager of choice
grep
handy for finding things
rm

handy for removing things. I think this was related to MySQL causing me grief
make
everyone else’s built tool of choice and I was installing a lot of everyone else’s stuff