Is source control overworked?

I hope all of you out there are using source control. I’ve used a bunch of different systems over the years, most recently git. Any sort of source control is a massive step up from none at all. It means you:

  • Have historic versions of your code.
  • A backup of your latest version in case your machine dies.
  • Can easily share your codebase with someone else.

Does anyone else think that’s quite a lot for one system? Are all of these different roles really supporting each other?

Source control as backup

Machines don’t die that often but it does happen. Maybe the hard drive goes, maybe the motherboard is bricked by something. It might be possible to recover data but that’s going to take, at the very least, time. Hardware tends to be pretty reliable nowadays so I’d be more worried about something else. Your laptop might get stolen or left on a bus, you can’t rely on getting those back. Your machine might get hit with ransomware, do you really want to pay the hackers? So, for all of those cases did you push your changes recently?

I’m not going to tell you to remember to check in your changes regularly. I’m going to say you shouldn’t have to. Ideally everything you write should be safely stored away. If you’ve got an external drive, a network server or the cloud an ideal backup system would just make sure your code was stored safely. Maybe you loose a few minutes work if your machine goes boom but certainly not days or weeks just because you weren’t at a sensible checkin point.

Source control as file sharing

Back in the day people might have been using floppy disks and passing things around. Nowadays everyone has access to the repository on some sort of server. That might be in hosted in the corner of the office or it might be in the cloud somewhere. In any case everyone has access to it and can get the mainline code.

It’s a bit harder if you’re trying to develop with someone or get an opinion on some code. Assuming it’s more involved than a screen share then that probably means checking things in and the other person getting the latest version. Did you want to check things in? It doesn’t matter, that’s what you need to do in order to share your code. Why can’t we just share our code directly? I’m sure it’s possible but that’s just not the way it is. With the right setup I should be able to see your code. Maybe it would let me edit that code directly, maybe my own version, maybe that’s a choice.

Source control as history

This is the big one. Source control keep track of all the version of your code. Well, it keeps track of all the versions of your code that you check in. As we’ve seen that’s a mixture of versions you wanted to keep, versions you didn’t want to loose right now and versions you wanted to share. Still, it’s amazingly useful. You get to see what changed when. There might even be useful comments explaining why it was changed.

With git my standard procedure is to take the somewhat messy history that comes from everyday work and then rework that to make it easier to understand. I put things in the best order, maybe squash several intermediate steps together. It can be temperamental. If something isn’t quite right then it has to be aborted and done again from the start. Command line tools don’t feel like the right place to be doing this. I’ve actually been looking at graphical alternatives recently and the selection isn’t great.

However this doesn’t give me all the history I’d like. There have definitely been times when I haven’t checked things in that I regret later. If you’re experimenting with a problem then do you check every single variation in? If you do your history is completely cluttered. If you don’t you might miss something later. What if it was more like an endless undo buffer which kept all the changes? Every so often you’d tag one of those versions with a subject line and comment but all the bits in between would also be kept. Navigating that might be more challenging but worth it if, say, you want to know why a special case was put in. Back in the day we might have worried about the amount of data that might make but space is cheap nowadays and code diffs aren’t that big.

In the end

Source control is great but we’re asking it to do a lot of things and they aren’t really complementary. However we all get use to systems and then go about using them as well as we can. I’ve been using source control for a while but the fundamental ideas still seem to be the same. I don’t have a solution to this but it would be nice to see something new.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *