Version control of software refactoring

Posted by Muhammad Alkarouri on Stack Overflow See other posts from Stack Overflow or by Muhammad Alkarouri
Published on 2010-05-29T17:18:17Z Indexed on 2010/05/29 17:22 UTC
Read the original article Hit count: 720

What is the best way of doing version control of large scale refactoring?

My typical style of programming (actually of writing documents as well) is getting something out as quickly as possible and then refactoring it. Typically, refactoring takes place at the same time as adding other functionality. In addition to standard refactoring of classes and functions, functions may move from one file to another, files get split and merged or just reordered.

For the time being, I am using version control as a lone user, so there is no issue of interaction with other developers at this stage. Still, version control gives me two aspects:

  1. Backup and ability to revert to a good version "in case".
  2. Looking at the history tells me how the project progressed and the flow of ideas.

I am using mercurial on windows using TortoiseHg which enables selections of hunks to commit. The reason I mention this is that I would like advice on the granularity of a commit in refactoring. Should I split refactoring from functionality added always in committing?

I have looked at the answers of http://stackoverflow.com/questions/68459/refactoring-and-source-control-how-to but it doesn't answer my question. That question focuses on collaboration with a team. This one concentrates on having a history that is understandable in future (assuming I don't rewrite history as some VCS seem to allow).

© Stack Overflow or respective owner

Related posts about version-control

Related posts about refactoring