What to Do After Waiting Too Long Between Commits

cowboy-codingdevelopment-processscmversion control

I was naughty… Too much "cowboy coding," not enough committing. Now, here I am with an enormous commit. Yes, I should have been committing all along, but it's too late now.

What is better?

  1. Do one very large commit listing all the things I changed
  2. Try to break it into smaller commits that likely won't compile, as files have multiple fixes, changes, additional method names, etc.
  3. Try to do partial reversions of files just for appropriate commits, then put the new changes back.

Note: as of right now I am the only programmer working on this project; the only person who will look at any of these commit comments is me, at least until we hire more programmers.

By the way: I am using SVN and Subclipse. I did create a new branch before doing any of these changes.

More information: I asked a separate question related to how I got into this situation in the first place: How to prepare for rewriting an application's glue

Best Answer

To answer, you have to ask yourself how you expect to use the results of these commits in the future. The most common reasons are:

  • To see what release a bug was introduced.
  • To see why a certain line of code is present.
  • To merge into another branch.
  • To be able to check out a previous version for troubleshooting an issue a customer or tester is seeing in that version.
  • To be able to include or exclude certain parts from a release.

The first two reasons can be served just as well with one big check-in, assuming you can create a check-in message that applies equally well to each line of changed code. If you're the only programmer, then smaller commits aren't going to make your merge any easier. If you don't plan on doing a release or testing with only part of your unsubmitted changes, then the last two reasons don't apply.

There are other reasons for making small commits, but they are for while you are in the middle of the changes, and that time is past. Those reasons are making it easier to back out a mistake or an experimental change, and making it easier to keep synced up with colleagues without huge scary merges.

From my understanding of your situation as you described it, it seems there's little to no benefit to splitting your commit at this point.

Related Topic