This week I was contributing to the dodo-ssg’s remote repo. My intention was to add a feature so that when someone types in “–config” or “-c” followed by a path to a JSON file, the program will read its contents and execute the commands inside of it. This is a useful feature when you don’t want to see a super long line in the command line interface filled with a bunch of commands. Here is my PR.
The way I decided to implement this feature was that I checked whether the user passed the config flag and if they did, I would try to open and parse the JSON configuration file. After this, I extracted the accepted properties from the JSON, overwriting any arguments that the user might have passed before.
When I was looking at a variable named “fs” and it took me a while to unfreeze and figure out that that was to store a file system😳
This time, I got to learn some more commands to work with Git.
Here is what I am adding to my collection this time😋:
Track a remote repo:
git remote add remote-repo-name remote-repo-url
Get commits and branches from the remote repo:
git fetch remote-repo-name
Switch to a branch from the remote repo:
git checkout remote-repo-name/branch-name
Merge a branch from a remote repo:
git checkout local-branch # switch to local branch
git merge remote-repo-name/branch-name
While working on the project, I had a little “committing to the wrong branch” situation. I couldn’t figure out how to “uncommit” from the wrong branch and then commit to the proper branch. If you ever find yourself being tortured with this like I did, here are some tips:
Move the main branch to its previous commit (before your wrong commit):
git reset HEAD^
Create a branch that you want to commit to
git branch issue-15
Move the branches location to the commit that dealt with fix
git reset ac8bdfb
Basically, here, we are just replacing the “wrong” branch with the “correct” branch so our commit appears in the branch we intended it to be.
This time it took me a while to actually sit down and start working on this contribution(🐌!!) because I didn’t know what solution to come up with. I learned that it is better to start working on the problem as soon as possible even if it just means setting everything up for the project or coding the first step of a solution. Because the more you think, the more fears come into your mind and it just becomes harder and harder to get started. In reality, most of the time it is easier than you think😅.
Next time, I will start working on a problem as soon as I can, even if I am scared because I can’t think of any solution. 🦾