Merges on Github
Tags: opensource, github, javascript, programming
Published: 2021-10-01 22:09:01

This is the __4th week__ I've been studying in __OSD 600__. And undoubtedly, it comes with my __3rd lab__. About this __Lab 3__, it's _way more easier_ for me comparing to the previous two labs. Because in this Lab 3, I'm going to _work with_ __my own SSG__ _(Static Site Generator)_ that I made _2 weeks ago_. Since I'm going to update my own code, it will _saves me a lot of time to go through the logic_ and __add some new features__.

#Requirement
In this __Lab 3__, we are going to __choose 2 features__ in the _following 4 features_ our professor provided: 
__Feature #1:__ Add an optional `-l`, `--lang`, and`/`or `\l` flag, which indicates the language to use when generating the `lang` attribute on the root `<html>` element. 
__Feature #2:__ Make sure that the program exits with appropriate error codes in all cases. If there are no errors, `exit with 0`. Otherwise, `exit with a non-zero exit code` (e.g., -1).
__Feature #3:__ Add support for inline` <code> `blocks. In __Markdown__, enclosing text in a single backtick causes the text to HTML to get rendered as `<code>...text...</code>`.
__Feature #4:__ Add support for a horizontal rule in __Markdown__. The Markdown `---` should get converted to an `<hr>` tag.
And the features I chose were __Feature #1__ and __Feature #4__

#Procedure
###1. Issues
After determined the features I'm going to add. I made up __2 Issues__ for my features.
[Issue #24](https://github.com/DerekJxy/My-First-SSG/issues/24): Add an optional `-l`, `--lang`, and`/`or `\l` flag.
[Issue #25](https://github.com/DerekJxy/My-First-SSG/issues/25): Add support for converting __Markdown__ `---` to an `<hr>` tag.

###2. Create Topic Branches
The following step is creating two branches [Issue_#24](https://github.com/DerekJxy/My-First-SSG/tree/Issue_%2324) and
[Issue_#25](https://github.com/DerekJxy/My-First-SSG/tree/Issue_%2325) of my __issues__ so that I can __work on them separately__. And they won't _impact each other_ or the _original branch_ that my SSG located.
Here is the code I used for creating branches:
```
$ git checkout master
$ git checkout -b Issue_#24
$ git checkout -b Issue_#25
```

###3. Commit & Merge
And then I __updated__ my code `git add` and __committed__ them `git commit` to the specific branch I created. And the last step was merge them to the __original(master) branch__ I have.
Just simply with the code:
```
$ git checkout master
$ git merge Issue_#24
$ git merge Issue_#25
```

#My Feelings
This is a __simple lab__ for me. _It doesn't have a lot of requirements_ and I don't need to work on other people's code which saved me a lot of time to understand the logic of the code.
__Working with branches__ is a __excellent__ idea when it comes to a huge public program. Imagine there are _more than 200 people_ working in a same project, and each of them have a different task to update the project. __Using branches allow them to work separately__. Once any of them finished the work, they can just `pull a request` and then the owner of the project decide to `merge` it to the __main program__ or not. 
And this __Lab 3__ gained me a good experience working on Github Merge!

Link to my repo: [https://github.com/DerekJxy/My-First-SSG]