DEV Community

Seog-Jun Hong
Seog-Jun Hong

Posted on

Merge my branches into Main

GitHub Repo: https://github.com/seog-jun/til-tool

I added two new features to my til-tool, one is to add -l or --lang option to include lang attribute into element, and the other is to make sure that the program exits with appropriate error codes in any situation by using exit code 0 or 1.

First, I created issue-9 and updated htmlCreator function under writeFile.ts file. It is pretty similar to adding CSS stylesheet with option -s/--stylesheet, so if the lang parameter is nothing, it will have Canadian-English as a default. Otherwise, it will take another language attribute. Also, I slightly modified index.ts file to put lang parameter as well.

Image description

Followed by issue-9, I created another issue issu-10 to update the program to have an appropriate error code with try and catch statement. When I implemented the program at the first time, I didn't take care about when the program failed due to the invalid file extensions or directories. At this point, I refactored the codes by adding try and catch statement with error code -1. So, when the code executes properly, it will exit with code 0, otherwise, it will trigger exit code -1. This is more clear than the previous code.
Image description

After I implemented two features, I had to merge the branches into the main branch. However, I figured out I made lots of changes on the first branch(for issue-9) and I was worried that it would cause a lot of conflicts when I merged another branch(for issue-10) later on because updated the same files and I have to merge conflicts manually line by line. At this point, fast-forward merge is pretty straightforward compared to three-way-recursive. However, in the field, three-way-recursive will be commonly used as we may update the same files at the same time on different branch.

Top comments (0)