---
# System prepended metadata

title: '**Assignment 2 Blog Post:**'

---

# **Assignment 2 Blog Post:**
# 

:::info
# Assignment 2 Information:
The purpose of this assignment was to create and utilize a simple Linked List class. However, more importantly, the main purpose of this assignment was to help us grasp Github and Git. It helped explain important Git topics such as:
* Adding and Commiting
* Reverting, Restoring, and Resetting
* Branching and Merging
* Most importantly, maintaining a clean version history
:::


:::danger
# Problems during the assignment:
In terms of the actual coding portion, I did not face many problems. The linked list class and the player class were all pretty easy to code. At times, I did struggle with trying to understand what a task was asking us to do, but when I did understand, it wasn't too difficult to code.

The majority of the problems that I had with this assignment revolved around Git and keeping a clean version history.
:::

:::danger
### Problem #1: 
One of the first problems that I encountered was with Task 6. The problem stated: 

```
Task 6: Recover player.java - |Master Branch|
```

After deleting the player.java file from my working directory, I was stumped on how to retreive it.

:::success
### Solution #1:
Since I started working on this assignment before we were done learning about it in class, I had to rely on Google and the course website. I don't remember exactly which site had this solution, but it explained the use of ```git restore``` to recover deleted files. This did work, however, after going through the lecture, I now know that the best way to do this would have been by using the ```git revert``` command instead. If this were to ever happen again, I would certainly use the ```git revert``` command!
:::
:::danger
### Problem #2: 
The other major problem I had revolved around keeping my version history clean. After task 15 asked us to Merge the DoubleLink branch back into Master branch, I noticed that I didn't have a merge commit statement. Furthermore, my version history wasn't showing that a commit happened at all. 

Again, this was before we went over it in class, so I was afraid that I would lose points because I somehow did the merge wrong. I knew I followed the steps for merging on the course website, yet, my merge simply wasn't showing up in my version history. As a result, I went into a loophole of reverts and commiting all in a feeble attempt to get back to a state before the merge so I can merge again. This led to an extremely messy version history with a bunch of unnecessary revert commits. 

:::success
### Solution #2:
In order to solve this problem, the first thing I did was contact the professor to ensure that I was at a point where my version history could actually be fixed. I was told to look into the ```git reset``` command which could be used to go back to a specified point in the version history. It also removes all commits up until that point as it effectively sets the branch head at the location of specified commit. This was really helpful for cleaning up my version history and I now have a linear version history that shows each task being done one after the other. This looks much cleaner than what I had at one point!

In terms of my intial problem of my merge not being visible in the version history, I learned in class that this was because git automatically did a fast-forward merge instead of a 3-way merge. Since I didn't do any work on my master branch between the point where I made a branch and merged, git was able to do a fast forward merge. I learned that if I want to avoid this in the future, I need to do a special merge command: ```git merge --no-ff```
:::

:::info
# Assignment 2 Debrief:

In conclusion, as mentioned above, the coding portion of this assignment was not too difficult at all. However, something I definitely will ensure in the future is that I wait for the lecture to completely go over a topic before I attempt to work on it. Many of the aforementioned problems could have been avoided had I simply waited on the second part of the lecture the following week. I will also definitely spend some time on GitHub practice template shown to us in class as a way to strenghten my Git skills. 

Overall, despite the multitude of problems that I faced during this assignment, I am glad that I did because they helped teach me a valuable lesson. Furthermore, had it not been for my mistakes, I would not have fully understood the ```git reset``` command!
:::

