Quick Github Intro
Tags: beginners, github, webdev, programming
Published: 2022-07-28 15:01:07

If we are not familiar with [Github](https://github.com/), then we are in luck. This article will give us an overview on what exactly _Github_ is and what's its purpose. Just about every modern developer is required to be able to use some type of [Version Control System](https://en.wikipedia.org/wiki/Version_control). So lets go ahead and dive right into it. 

## Table of contents 
  * [Introduction](#intro)
  * [Repository](#repo)
  * [Commands](#commands)
  * [Conclusion](#conclusion)

  


## Introduction <a name="intro" />

__What is Github?__ 
Well in technical terms it means the following: 
> Open Source Distributed Version Control System

Let's break it down to more simpler terms. 

- __Open Source:__ Free to use software where the source code is visible to the public and allows anyone to use it, study, update, and even distribute. 

- __Control System:__ Manages, distributes, and stores content. Such as code, writing, pictures, and more types of files. 

- __Version Control System:__ Software changes rapidly, so Github is a platform that allows us developers to make changes so often and make code better. So we have a nice history of all changes made in the code. 

- __Distributed Version Control System:__ Github has a remote version stored on the server and stored locally on the developer's computer. Meaning the code is available on a central server, available to all developers to work with.


Before there was any type of [Github](https://github.com/) platform for developers to collaborate on projects, it was much more difficult to share source code to the public, and have a full history of the entire changes. Most of these before __Github__ existed were all either exclusive from the company to share with their own employees or working on some local source code server. 

Github solved this issue with allowing anyone to publish code that they wanted to share with other developers. It became such a big thing that [Microsoft](https://www.google.com/search?q=microsoft&rlz=1C5CHFA_enUS823US823&oq=microsoft+&aqs=chrome..69i57j0i67j35i39j0i131i433i512l5j0i67j0i131i433i512.1818j0j7&sourceid=chrome&ie=UTF-8) ended up acquiring [Github](https://github.com/) for nearly $7.5 billion u.s. dollars. I think that should just tell you how important this type of software is to the modern application world. 

![Microsoft github](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fo7l7y19v5sn3nqejswq.png)

_Making it the largest host of source code in the world._


### Repository <a name="repo" />

So how exactly do we keep track of changes in our code? With a __Repository!__ 
When we look at the word [Repository](https://www.google.com/search?q=repository+definition&rlz=1C5CHFA_enUS823US823&oq=repostit&aqs=chrome.2.69i57j0i10i131i433l3j0i10i433j0i10i131i433l2j0i10j0i10i433j0i10i131i433.2693j1j7&sourceid=chrome&ie=UTF-8) for the first time, it might be a little overwhelming. But once we understand the definition of it and it's purpose, we will see why repository's are a big thing. 
 

> A place, building, or receptacle where things are or may be stored.

The `.git/` folder would act as our __Repository__ in our project. This folder should always be at our root of our projects folder.

e.g.
![git example](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x5kjokww1tm1dzw56dim.png)

The way we keep track of our changes in our code is with a few `git commands` that we can either type in our `terminal` / `command line`. 

### Git Commands <a name="commands"/>

Our `.git/` folder doesn't simply track our files automatically. We would need to tell our `repository` to accept the changes we have made with a few simple __commands.__ There are a lot of __commands__ to use for specific reasons but we're only going to mention the ones that are the most commonly used to help us track our work progress. 

- `git status` : When ever we want to see our changes within our directory, we can run this command in our terminal, giving us a list of files that have been changed, and being tracked.     

- `git commit` : We can use this command to save our tracked files to our local repository. We can also leave a message / description about the changes we have made. Importantly this is what allows us to save different states of our code from different stages. 

- `git clone` : This command will allow us to clone any `repository` that is available to use from the Github platform. Some may be private and require access to them. 

- `git branch` : An essential command that allows us to create different path's if we ever need to work on different components. Allowing us to test, debug, and more than working on our main file. Think of it as having a `Production` and `Development` paths. 

- `git merge` : Merging our paths or branches together is another essential command, allowing us to work on different task on different branches. Once we believe we want a branch merged with another, we can use this command to achieve that.

- `git push` : We can also upload our local repository that we have been working on our machine to the remote repository on the Github platform for others to see or use. 

- `git pull` : Updating our local repository is very common when working on a team project. This command will allow us to update our local repository to the latest remote version.  


Here is a brief example on how we would use these git commands to track our work. 


1. Clone: You will clone the repo to have a copy to work with on your personal computer.
2. Branch: Checkout a branch and name it using the firstName-lastName format.
3. Complete Assignment: Do all the work on your assignment on your personal computer. Commit your work regularly.
4. Push: Push your local changes to your remote repo branch.
5. Create a Pull Request: This pull request will be made with your student branch against the fork you created in the beginning. Submit this link to Canvas.


### Conclusion <a name="conclusion" />

I hope by the end of this article you managed to learn how to create and understood what is going on in every line of code. It is very important to understand how your code fully works, not only does it help you become a better developer but can also help you use the tools you are working with more efficient.

These articles are mostly intended for personal use on becoming a better programmer, writer, and grow my programming skills. Feel free to drop any feedback or corrections that you believe that should be made to help me and others. Thank you for your time for sticking this far! 



- [Twitter](https://twitter.com/CleverOscarDev)
- [LinkedIn](https://www.linkedin.com/in/clever-oscar/)
- [Github](https://github.com/CleverOscar)