[OSD600]Git remotes, git revert

I was having a busy week as I had to prepare for my interviews. It’s not until I read the messages on Slack and found out that I still need to submit a lab by Friday. Oops! All Javascript repositories were picked and only C# left. And I had no other choices …

This is the first time I have seen C# codes on Diana’s repo. I was having difficulties with running the project at first but thanks to Diana’s help. I was able to get it up and running.

I just have 01 day left and I completed it in 02 hours and a half. I did this by asking my friend who is a newbie with C#. He helped me to install the library, get familiar with Visual Studio Code’s tools and syntaxes. All of the codes and the approaches were written by myself.

STEP 1: Work on Diana’s repo

My approach is to read the .json file => parse the content to Json’s object by using a .NET’s library => assign them to current arguments so that I can reuse the old codes.

STEP 2: Create a draft pull request

Diana’s repo

Step 3: Work on my repo

Three days later, I read lab4 carefully and found out that I made a mistake. I should have created remotes and did some testing on Andrew’s branch. Silly me!

I had to revert the pull request from the remotes and revert the codes from my local machine (I accidentally did pull origin main when I was at`main` branch.

Here’s how I did the revert in my local machine:

git log --oneline To check the position of the head

git reset -—hard commitNumber set HEAD to the previous position

git clean -fd

git push -f origin main

I also revert the pull request from the browser by clicking the closed pull request and revert it.

Step 4: Test and manually merge

git remote add Andrewnt219 https://github.com/ritikbheda/cmd-ssg.git

then

git fetch Andrewnt219

which fetches his support-for-config-file’s branch

Then I did

git checkout -b support-for-config-file Andrew219/support-for-config-file

which creates my own local copy of his branch on my computer.

I proceed to test the code, then I will do a merge to main branches when it’s completed.

$ git checkout main

$ git merge Andrewnt219/support-for-config-file

$ git push origin/main

Andrewnt209’s repo

Happy coding!

Computer Programming Student @Seneca. Writing to share solutions and encourage my sister to write.