DEV Community

DenisC
DenisC

Posted on

Adding Features to My Open Source Project in Different Branches

In this week, I have practised adding new features in my project through working in parallel branches. The features I added were a -l flag that includes line number when displaying file content and a -d flag that hide file content.

When implementing the features, I used separate branches to change codes for each features based on the latest codes on main branch. I firstly added a commit for the -l flag, then added another commit for the -d flag. After changing the codes in both branches, I merged the changes for the -l flag, which ran smoothly as the codes in main branches had not been changed. Problem came when I tried to merge the changes for the -d flag, as it was based on the previous codes on main branch before the codes for -l flag was merged, conflicts arose. Thanks to the experience I gained resolving conflicts last time when I was accepting pull request from others, I had become more confident in resolving conflicts and eventually merged the changes in both branches.

From this practice, I have learnt that merging changes with conflicts is a common issue when different people work on the same project in different branches in parallel, so it is important to learn how to deal with conflicts, by paying attention to details when merging and test the codes after resolving conflicts before pushing. Moreover, when complicated changes are anticipated in major updates, it is better to perform the updates one by one, such that conflicts can at least be minimized if not avoidable.

Top comments (0)