What if Professor Snape used GitHub?
Tags: github, tutorial, opensource, git
Published: 2022-01-07 04:43:41

>A Parody on git and GitHub 

_This is an introduction to GitHub and Git aimed towards beginners and professionals alike. Anyone who wishes to see Snape open **sorcerer-ing** his special edition spell and curses book is welcome to read this._

## What if Snape survived?

> Severus Snape is a fictional character from the Harry Potter Books

In this alternative timeline, somehow Snape survived. He then realizes that he ought to get famous now. He is done protecting Harry since Voldemort kissed everyone goodbye for the last time. He is finally done with all the _Lily's eyes_ thingy. 

He being the most gifted wizard of his time decides to open source his new book: 

> Advanced Potion Making Vol-2 - by Severus Snape 

One reason also being that he wanted to save this new book from any life threatening event. He painfully recalls his original book.

### But how can he do this?

> Muggle is a made up word from the Harry Potter books which refers to people who are not from the world of magic.

Snape decides to use muggle tech for this. For some reason he started a liking in muggle-tech. He went on to **GitHub** although most probably it didn't exist in his time but whatever, maybe he lived very long. 

> Legend has it that every time Snape took of 10 points from Gryffindor his upper life span increased by 1 year

<p style="text-align:center;" align="right">
  <img align="center" src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jfwyb2h8gps60hg14gkq.jpg" alt="Severus Snape taking points of Gryffindor meme" width="75%"/>
</p>

So Snape, in his new Slytherin themed PC, goes on `GitHub` and creates a new repository (basically a place to store code and documentation). 
_**What do you think Snape's GitHub username would be?**_ Comment down your thoughts on this. Would appreciate fellow **Potterhead's.**

So he creates this new repository named `Half-Blood-Prince`.
In order to follow along, go though the following steps:

1. Visit [GitHub](https://github.com/) and create an account.
2. Click on the `+` icon at the top-right corner - > `new repository`
3.  Name it appropriately - > `create repository`

Snape now has a safe place to store his book on the **internet** 
 (_a muggle technology that connects people from all over the world_). He _pushes_ the contents of his book inside this repository. He does this using a tool known as [`git`](https://git-scm.com/). 

> Basically git is a software that helps you store your code/documentation safely on a storage space such as GitHub as well as helps you (in collaboration with GitHub) to work with different people from around the world. 


![Git](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rgee2lq3a9gwlqo8qtck.png)

After a few months, his book had over a million readers. He decides to go on a vacation to celebrate.

He's now in Hawaii having the time of his life. He forgot that his Slytherin themed PC is back in home. He is now receiving emails from people all over the world asking for the Code for his various spells.

Pressurized by his new fame he buys a new laptop and is able to get his book back thanks to `GitHub` and `git`. He does this in the following way: 

1. He logs into his `GitHub` account and navigates inside his repository: `Always/Half-Blood-Prince`
2. He **clones** it. Cloning literally means the way it sounds. Getting a copy of the code/documentation. 
He does that by clicking on the `Code` button and then copies the `HTTPS` link in order to be able to get the book locally on his new laptop.
3. He opens a new folder on his PC and initializes it.
4. Next he clones it and creates a separate branch in order to work on his codes.
5. And then goes onto add files such as `Sectum-Sempra.cpp` etc. The commands followed respectively are listed below:
```
git init
git clone https://github.com/Always/Half-Blood-Prince.git
git checkout -b Spell-Codes
git add Sectum-Sempra.cpp
git commit -m "Added my favorite spell"
git push origin Spell-Codes
```
`git init` initializes/prepares the folder/space for you to put your stuff in it.

`git checkout -b Spell-Codes` actually does two things. It creates a new branch `Spell-Codes` (the `-b` flag) and checks out into it. Creation of a separate branch helps us work on the code/documentation without affecting the original content directly. This is a safe way of working so that you can safely build and test your new stuff before pushing it into the main repository. 

`git commit -m "Added my favorite spell"` helps Snape remember what he did and when he did it. The `-m` flag enables us to write the message in the command itself.

Now Snape visits his repository on GitHub and opens a pull request. He examines the changes properly and merges it into the `master` branch i.e. he safely clubs the new changes with the original.

> Snape's life is going well now since he is making loads of money from his sponsors. He regularly pushes stuff now. He is getting ambitious. Let's see how life goes for him in the coming posts (maybe..).
 
You might want to go through a few resources posted below in order to understand more about git and GitHub:

- {% youtube mJ-qvsxPHpY %}
- {% youtube RGOj5yH7evk %}

_If you found this post useful and fun to read, then consider leaving a like and comment down your theories. Also, feel free to suggest any changes or further topics you'd like to be written_.
 
### _-Peace_