Today, I'm just going to talk about what it's like to merge branches using Git.
Git is a wonderful tool that helps you manage your repo. You can switch back and forth between different snapshots of your code you made for each thing you want to add/change and work on them separately. Once you are good, you can combine/merge them back to your main snapshot. A snapshot is called a commit, and it and the history of commits leading up to it is a branch.
To address two changes I wanted to add to the static site generator I talked about in previous posts, I first opened one issue for each: 1 2
Then, I made a branch to work on for each them: 1 2
Spoiler: I did merge them back to the main branch, as you can see!
Once I'm satisfied with the work, I merge them back to the main branch. If there's any conflict, git would put some conflict markers for me to address before continuing. Basically, if it doesn't know which version of the code to keep, it will do that for me to decide. Luckily, it's pretty smart. However, I did some testing just in case. I mean, that's the safe thing to do. And no, everything turned out to be fine thanks to how smart it is.
Just read the links...I'm kidding.
The first change was adding support to allow language selection for the HTML output files.
I added the option
--lang to allow users to specify what language they want to use.
This will decide the lang attribute in the HTML output file. For example,
-l pt-BR will indicate the file is in Brazilian Portuguese, and it will have
<html lang="pt-BR"> in the HTML code.
The default would be Canadian English:
- Added code to allow and recognize
- Added a variable to hold the language value, with
The second change was adding support for horizontal rule in Markdown input files. Essentially, this allows the tool to parse
--- in Markdown files and convert them to
<hr> tags in the HTML output files.
- Added code for file writing to replace
---or longer variations with
<hr>tags in the HTML output files.
- Added code to ignore lines made of tags, such as
For both, I updated the
README.md and help option to let users know these are part of the tool.
I forgot to include some of the text explanation for the changes I made in README.md and the help option, when I merge the branches. I ended up adding them afterwards. I should probably remember to include them in the future for organization sake. Other than that, it's mostly stopping myself from wanting to edit a lot of things at once and sticking to the focus of each branch. Sometime, I just see some code or slight formatting issues that I want to edit right there. Hey, I managed, and this teaches me to note things down to address separately.