Ionrock Dot Org

by Eric Larson

My Weblog

Pushing Code

I'm quickly becoming a true fan of using a DVCS. I've always liked the ideas, but in practice it has been somewhat difficult to establish a workflow that seems an order of magnatude better than something like SVN. One aspect that can get a little confusing is when to push code. Using something like SVN, when you commit you effectively have added your change to the repository not only for yourself, but for everyone who uses the code base. This obviously makes a commit a serious thing because it is public and has an immediate effect.

When you use a DVCS there is a separation between making a commit and making it public. You should be committing quite often in a DVCS because that is partly the point. What comes into question then is how you make the decision to push. In one sense it seems obvious tha you'd take the same precautions pushing in a DVCS as you would commiting in something like SVN. When the feature is finished, then push. As simple as that souinds, you have to consider that you might need to pull changes before you push. This may or may not conflict with your work. How you handle merging conflicts doesn't necessarily mean simply making sure there are no conflicts. There is also the log and history to consider. If you rollback to a certain revision, have you also rolled back someone elses mid-feature commits?

The point here is not necessarily answering the question of when to push. I think you should take the same precautions as before. The code should work and you break the build (even if that build is starting a python web app). The question is how to manage your local repo in a way that makes helpful breakpoints possible while still keeping the public repository an effective record of where the code has been. I always believed DVCS' would make that local repository management obvious, which is entirely untrue. But, now that I've managed to wrap my brain ever so slightly around how to keep a decent local repo, my ideal DVCS world seems to be working out.

Posted Fri Aug 7 06:51:59 2009 by Eric Larson
Created using Python, jQuery and Emacs