[OSD600]Git remotes, git revert
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
I created a draft pull request to let Diana know that I’m working on. Lucky for me, she’s online at the time.
Step 3: Work on my repo
Actually, I got a pull request from Andrew but I didn’t think that it was for lab4. After reading his codes, I was pretty sure that my program would run without crashing and I accepted his merge request without actual testing.
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
I used the command:
git remote add Andrewnt219 https://github.com/ritikbheda/cmd-ssg.git
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