Revision numbers considered harmful

When using Subversion for vertion control, I was always conscious of revision numbers when committing. It was as if there was a limited supply of revision numbers, and I didn't want to waste them making tiny commits. So, I'd often bend over backwards to make sure the change was significant enough to be “commit-worthy”.

It's an awful habit, to be sure, but I know I'm not the only one. I recently had one of the programmers I manage (a very bright kid, if still a bit green) apologize to me for committing 20 revisions in a single day, as if it was wasteful or inconsiderate to make frequent commits! I think you become less concerned about “wasting” commits as you get more experienced, but it was still always in the back of my mind.

Not so with Git. The reason is simple: Git doesn't use incremental revision numbers. Instead, it uses a long string of digits and letters which is totally meaningless to a human being. (Getting technical, it's based on a SHA1 hash of this commit and previous commit(s), or some such thing. But it's non-obvious to a human what the connection between 2499051dca30def85f5433c08519adea56a12a14 and its parent aaaa83fc4e9737b41a5c52b16e946b34dab63ede is.)

Since the commit identifier is totally meaningless to me, I don't pay attention to it (except in the rare cases where I need it, such as checking the diff for that commit). And because it's not a number that gets larger the more I commit, I don't feel like I'm “wasting” numbers by commiting often — sometimes several times per minute.

Yet another way Git and other distributed version control systems assuage our obsessive-compulsive tendencies and promote good habits.


Comments


I actually miss subversion incremental revisions.

That, and I am totally unconcerned with the number of commits I made. If I am very productive, I don't have a problem with committing hundred of them everyday.


The only problem is that later, when you look at the log, you see a lot of little commits and have to look hard to find the meaningful ones. But you can always squash them later (that is, if you didn't push them yet).


Comments are closed.

Previous post: Migrating projects to Git Next post: Git tip: Fix a mistake in a previous commit