views:

95

answers:

2

To learn Doxygen, I created a branch and modified the source file comments of a slow-moving project. However, that project has since had large changes, splitting a large file into several smaller files:

big_file.c -> big_file.c file_a.[ch] file_b.[ch]

I want to do the same on my branch. Obviously, I can duplicate my branch's large_file.c as file_a.[ch], etc. and merge by hand, deleting the irrelevant portions. However, I was wondering if there were less error-prone ways to do this.

A: 

git merge can automatically follow these sorts of changes in some circumstances. I'd suggest trying a straight merge first, before doing anything complicated.

bdonlan
I had tried git merge. It does propagate some of the changes made to big_file.c on the doxygen branch to the new file_a.c, but drops others. This is a source of errors; I would have to redoxify the comments (which are scattered all over the source, causing much mismatch during the merge).
themis
+1  A: 

It's been awhile, but I did the merge fairly quickly, if boringly. For future reference, the project followed two good practices:

  • Frequent small commits
  • Only splitting was done, no new features were added

The first change I merged into my branch was the creation of several empty files (file_a.[ch], file_b.[ch]). Simple merge. The second change was the cut&paste of code from big_file.c and its incorporation into file_a.[ch]. That merge was simple, even with some conflicts. Similarly for other changes, until the HEAD of the project was merged into my branch with very few conflicts. Tracking changes since then has been trivial.

themis