Process of working in parallel branches in GitHub
Tags: beginners, opensource, cli
Published: 2023-09-15 20:31:34

GitHup Repo:https://github.com/avelynhc/til_tracker

**Changes made for new features**

In the [first issue](https://github.com/avelynhc/til_tracker/issues/6), users can now specify their desired language for the generated HTML files by using the optional argument `-l` or `--lang`. 

This feature was implemented by adding a new argument option `-l` or `--lang` in [yargs](https://www.npmjs.com/package/yargs) as below. 
```typescript
.option("l", {
     alias: "lang",
     describe: "Language used in generated file",
     default: "en-CA",
     type: "string",
     demandOption: false,
})
```
Once the app receives the language argument by the user, it will be passed to other methods, including , including `readFile()`, `readFolder()`, and `convertToHTML()`. 

In `convertToHTML()`method, 
```typescript
<!doctype html>
<html lang="${userInput}">
...
</html>
```

userInput will be replaced with actual user input.
This issue was closed by [merge commit](https://github.com/avelynhc/til_tracker/commit/0f155cf887ffc53d9b41300f4f0b73f69fe67c70).

In the [second issue](https://github.com/avelynhc/til_tracker/issues/7), it was ensured that the program exits with appropriate error codes in all cases by using `process.exit(-1)`. 

For example, 
```typescript
fs.stat(argv.input, (err: any, stats: { isDirectory: () => any; isFile: () => any; }) => {
    if (err) {
        console.error(err);
        process.exit(-1);
    }
...
});
```

This issue was closed by [merge commit](https://github.com/avelynhc/til_tracker/commit/072cc8c446f3a93c7e3f4e2ca7a12d5ffaba2e57).

**Process of doing merges**

The first merge with the first branch (issue-6) went smoothly, but when attempting the second merge with the second branch (issue-7), a conflict arose. I had to go through the files with merge conflicts one by one, selecting the code I wanted to proceed with. After resolving the merge conflict, I pushed the final code to GitHub.

**Problem I had** 

When changes in one branch conflicted with those in another, I initially struggled to find a solution. I turned to online resources and managed to resolve the issue. It involved identifying a few lines of conflicting code and carefully modifying them one by one. This experience demanded meticulous attention to details.

**Learning opportunity**

I learned how to create, manage, and merge branches efficiently, improving my proficiency in GitHub. Additionally, reviewing and providing feedback on code changes in parallel branches helped me develop code review skills and encouraged a deeper understanding of others' work. Overall, working in parallel branches in GitHub was a rich learning experience, honing my skills in version control, collaboration, risk management, and other critical aspects of software development.

**What I would do differently next time**

I felt overwhelmed when I had numerous branches in GitHub, so I would opt for more descriptive and standardized branch names to enhance clarity and facilitate easier identification of their purpose. Additionally, I encountered some challenges with merging conflicts while working on this project. In the future, I would prioritize addressing merge conflicts promptly and comprehensively to prevent prolonged delays in the development process.