views:

36

answers:

2

I have a .cpp file and .h file containing a class. Class.cpp contains the implementation and Class.h contains the definition. The class is overcomplicated so I want to separate some code and move it into a separate class. So I create NewClass.cpp and NewClass.h and move the code there.

How do I handle this when the files are under SVN?

I can simply "svn add" the two new files, but then they will appear as new and will have no history. I could instead "svn copy and rename" the two initial files and edit the the two old files and the two new files - then the two new files will have common history.

Which approach is better from the point of version control? Should the new files share history with the old files or should they appear as new?

+2  A: 

just my personal opinion, but I would go for the common history. This opinion is based on the pain of dealing with CVS for years (where moving files loses their history)

Kimvais
+2  A: 

I would do the copy, and then trim the unneeded code from each file. Keeps the history easier to follow. Use a descriptive commit message. Can't think of any reason not to do it this way.

msemack