This week for OSD, I was asked to develop two features for RefactorCode by creating two separate issue branches from the main branch. This brought up sweet memories of Merge Conflict issues while working on my personal projects. I usually tried to make sure that for features that are modifying the same files, I do them one after the other but in a professional development project, this can be nearly impossible with multiple collaborators working at the same time.
The Two Features
The first feature I worked on was streaming output, allowing users to stream the refactored code directly. I had some trouble getting it to work at first, but after going through the Google Gemini documentation, I was able to fix the issues.
Next, I worked on processing multiple folders, which was easy since I had already added support for processing multiple files earlier. There weren’t any major problems with this one.
Merging and the Merge Conflict
After finishing both features, I decided to merge them into the main branch. I started with the streaming feature because I finished it first, and it merged without any issues.
But when I tried to merge the folder processing feature, I ran into a merge conflict. Most of the conflict was in one file since that’s where most of my code is, and there were issues in several different places. At first, I wasn’t sure how to fix everything, but VS Code’s merge editor helped a lot. It shows both branches side by side, which made it easier to decide which changes to keep.
I went through the conflicts and fixed them one by one, and while I was at it, I cleaned up some duplicated code. After testing it, everything seemed fine, so I thought I was done and took a break.
Fixing the Last Bug
The next morning, I ran the tool again and noticed that the refactored output wasn’t being written to the correct file. After debugging the code, I found out that the arguments for the output file name weren’t being passed correctly to some of the functions. I fixed that, and after testing again, everything worked perfectly.
What I Learned
This week, I learned a lot about handling merge conflicts, which I’ve always tried to avoid in the past. I also realized that having most of my code in a single file made it harder to resolve the conflicts. I probably should’ve broken the code into smaller pieces earlier. Oh, and next time, I should make sure to run the refactoring tool on my own code before wrapping things up!
Overall, it was a good experience, and I’m glad I got the chance to improve my conflict resolution skills.
Top comments (0)