Today, I was working on converting my blog's static title-bar and sidebar into an .ejs include (via a custom function to parse content and another function to insert the includes manually). This went quite well. I had finished converting all of the responses to use my function instead of sending the .ejs files on their own. Once that was complete, I wondered if I would be able to push this to my Github Repository from (the cloud IDE I use while at school). I was surprised to find out that I was, in fact, able to initialize a repository and link it to the using git remote. I was ecstatic about the new git functionality that was put into as it had never worked before! So I did what I had set out to do, I ran git commit and git push, excited to finally export via Github while on the IDE. One problem occurred which destroyed my entire repository. Not the problem itself, but the actions I took to get around it.

Once I ran the git push command, the terminal sent an error message telling me to pull before I push. So I did just that, I ran git pull and everything was fine. So I then tried to push again, but that didn't work. I then, getting impatient, tried to remember the command to perform a hard push without pulling or checking for conflicts. After the first few commands came up as an error, I tried the one command that changed not only my repo, but my entire day. git push --force. This, I thought, would fix my problem. I would be able to push without anything going wrong. I'll tell you what, everything went wrong. After doing what I thought was the right thing, I went to the Github Repository page, excited to see my changes go through. When I arrived at the page, I was a bit concerned that my repository had only one single commit. At first, I feared that I had wrecked the entire thing. I thought, "I broke it. I actually broke it". But then I saw that I had three branches, one with 33 commits. So I, feeling like nothing went wrong, checked the branch with the 33 commits. I looked at the date of the most recent commit: May 14th. This is the moment where I knew I'd pretty much broke the repo. But just to be sure, I went back to the master branch to take a better look at that one commit. Sure enough, the entire master branch had that single commit with its message tagged to every single file: "change template workflow"

After about 30 minutes of frantic searching, I found no answer to my problem. I tried many git commands to try and revert the damage I had done. Nothing worked. I thought that I'd have to create an entirely new repository, but then I remembered. I still had all of the other commits still stored on my laptop at home. So my repository wasn't ruined after all. It took a lot of hard work and many pushes and pulls to get it back up and running. But in the end, everything was back to normal.

So I'd like to leave you with a truly helpful and life-changing tip: "Github can be dangerous. Take your time and be careful!"