DEV Community

Harshil Patel
Harshil Patel

Posted on

Working simultaneously on different branches and merging them.

This week for the open-source development course at Seneca Polytechnic, I was asked to work on 2 new features for my ResumeEnhancer project simultaneously in different branches. I was given a list of features from which I had to choose 2 features. Firstly, I decided to update one of my current command line arguments --model/-m to accept multiple models and give a response for each of the given models. Secondly, I choose to add --stream/-s command line argument for allowing users to stream output.

The Process

To begin with, I filed issues on my GitHub repo regarding these features, for example, Issue-19 and Issue-18. Next, I derived two branches from the main branch to work on these issues. Although there new enhancements looked simple, it took way longer to code them.

First of all, I started with a feature to add a streaming option. It was a simple change and I added a new command line argument parser. Following this, I made some changes to the request I was sending to the LLM model and it was completed. As per instruction, we were supposed to merge both feature branches together, so I started working on the second feature. I made a few changes in the code to accept multiple models with --model/-m argument and utilize a loop to request LLM with each model separately.

After implementing both features, it's time to merge them into the main branch. I started with the streaming feature as I finished it first, and it merged without any issues as it was eligible for fast-forward merge. This type of merge occurs when the new branch is directly in line with the source branch. Instead of making a new commit, Git just moves the target branch to the latest commit on the source branch.

However, merging the second branch was not that straightforward. When I tried to merge the multiple model feature branch, I ran into a merge conflict. Although I have resolved merge conflicts before, it was still not that easy to solve this one. VS Code's merger editor helped me a lot in fixing these conflicts as it shows both branches side by side and the final version at the bottom. I went through the conflicts and fixed them all and here is the merge commit. Following this, I did some testing to make sure that both features worked as expected together. Even though I tested the code completely before committing, I found some errors when I presented the new features in our class. After debugging the code, I found that when I was trying to save the output to some file and passed multiple models, It was failing the code. I fixed this issue and again pushed the latest code to the repo.

Conclusion

This week, I gained valuable experience in dealing with merge conflicts. I also discovered that keeping most of my code in one file made resolving conflicts more difficult. I probably should have split the code into smaller parts.

Top comments (0)