"GET" GIT
Published: 2023-03-14 23:20:15

_Let's clear up the first thing that probably came to mind: GitHub is not Git._

![GIT](https://camo.githubusercontent.com/6eaaae8defc78f268eaf0824350a66a1dfcb6aa77210d3dca069d1d1cefebc53/68747470733a2f2f6769742d73636d2e636f6d2f696d616765732f6c6f676f732f646f776e6c6f6164732f4769742d4c6f676f2d32436f6c6f722e706e67)

## **WHAT IS GIT?**

Git is a Version Control System (VCS). Now, hold on, don't let me lose you already; it's pretty simple. Firstly, Version Control is when the changes to a project are marked with whodunit, what they did, and at what time/date. This allows a multiple-person project to figure out who to blame when something goes wrong (slightly kidding) or if you're working on it alone, you can see where you decided to self-sabotage (definitely kidding... I hope).

Now, a Version Control _System_ is a software tool that helps you track all of these changes. There are many out there, but the most commonly used one is Git.

## **WHY IS GIT SO POPULAR?**

The biggest reason Git is so popular is because of the way it handles the project data. VCS generally write over the project files with every save of your work, but Git creates "snapshots" of the project file every save. Now that I've explained a bit, we'll use "commit" instead of "save". 
Git focuses on the content, rather than the names of files. The other VCS options can sometimes do this, but not as fast and simple as Git can. 

![Speedy](https://media.tenor.com/uUqrE-zkEe0AAAAM/omw-running.gif)

Another reason that Git is the main choice among programmers is because it allows you to work on your own, remote computer. As long as you commit your work to the database (also known as the main branch), other people can pull that work from the database onto their local computer to continue working and vice versa. 
Make sure your coworkers commit their branches too so that you can work with their new commits if needed!

## **SNAPSHOTS? BRANCHING? WHAT?**

I think this image sums it up pretty well:

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

The master (now referred to as main branch) is what the program uses to run. Every time you commit your work to the main branch, Git creates a snapshot of what it looked at the time. It does not overwrite anything, but rather creates a path of past information. This allows everyone to see the different snapshots of work to find bugs, or if you decide 20 commits down the line that you want to scrap all of this work, you can find which snapshot you'd like to work from way back when.

Now, where is all of this main stuff being stored, you may ask?

Cloud-based services like GitHub store all of the Git data for you! It is a centralized and online location that stores all of the Git history for your program.

## **OKAY, I GET GIT... BUT HOW DO I USE IT?**

Let's walk through some very basic steps so you're set up to rock n' roll.

Download Git, configure the settings, and unless you really know what you're doing, it's recommended to use the command terminal on your computer to control Git.

![Command Terminal](https://linuxcommand.org/images/Screenshot-Terminal.png)

Once that's done, open the command terminal and use it to open the file you'd like to store your Git repository (snapshot) into This is done by using the command "cd" followed by a space and your file name. The name has to be exact, otherwise the terminal has no idea what you're talking about. 

When in the directory (that folder you just entered), you need to connect to your profile that is set up with the Git cloud-based service; the computer needs to know where to commit to the main branch and how to pull other commits. Go create a profile on GitHub if you haven't. 

Do note that you don't have to use GitHub, but it's extremely common and simple, so we're going with this one.

Now that you have a profile, enter the code below but put your credentials within the " " instead:

![Git Username and Email](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pw8gv3atmphbje3yvz0t.png)


Last step is to now connect to a remote repository. If you haven't already, create a new project on GitHub and copy the repository's address to then paste in your terminal AFTER typing "git clone":

![Repository Address](https://www.howtogeek.com/wp-content/uploads/2019/12/git-clone-command.png?trim=1,1&bg-color=000&pad=1,1)

That's it! You're connected to the project and ready to get going. If you don't know what to do next, this website has a handy table of git commands, ready for you to check out: {% embed https://confluence.atlassian.com/bitbucketserver/basic-git-commands-776639767.html %}

Hopefully this has been a helpful guide for you to Git a grasp on the basics of Git. Now go out there and have a grand time with programming!

### References:
https://www.perforce.com/blog/vcs/what-is-version-control
https://dev.to/gittower/8-reasons-why-git-is-so-popular-3mj4
https://git-scm.com/book/en/v2/Getting-Started-What-is-Git%3F
https://www.atlassian.com/git/tutorials/what-is-git