DEV Community

Cover image for Lab 3 - Merging and resolving code conflict
Kevan Y
Kevan Y

Posted on • Updated on

Lab 3 - Merging and resolving code conflict

Intro

For my third lab, we have to implement 2 more features to our Static site generator CLI. I choose to implement markdown support for horizontal lines and language support for HTML tags.
But this time we do not create Pull Request for each feature that needs to be added. We have to create one branch for each feature. After finishing the feature we merge both branches to the master branch and push to remote.

Process

So I started to create a branch call issue-19 for my Issue#19 then another branch call issue-20 for my Issue#20. I checkout issue-19 and started to add my language support for HTML tag. After finishing implementing my feature 8bcd08a, I committed my changes and switched to my issue-20 branch where I have to add a support markdown horizontal line. After finishing implementing this feature 9bee88d. I found out I have to go back to my issue-19 branch and add another commit to update documentation f2608c4. The same thing for issue-20 bc7ec05.
After all, was done, I checkout my master branch then merged my issue-19 branch first which I did not have any issue merged it since it was a Fast-forward merge. But when I merged my issue-20 branch I had to resolve the conflict first do a commit for resolving the conflict 7ea3f6e, this is also called a 3-way-merge. After all, this is done I pushed my master branch to remote, then closed my issue + adding a message Closed by <short_name_issue_code>.

Conclusion

Git is very powerful. It can help us to work on two different features without making 2 hard copies of the project. I can start working on one branch and if I want to work on another branch I can either stash my work or commit my work then switch to my other branch to work on the other feature.

Top comments (0)