Introduction to Git
By: David Guillory
Tags: Introduction, Git, Codingbootcamp

Hello and Welcome to my beginners guide to Git. If you are reading this then most likely you are in the beginning stages of learning how program and how to work with others. It is suggested that you are familiar with working with files and projects in your code editor. So what is Git? Git is a distributed Version Control System(VCS). Using Git allows us to track the life cycle of our project and shows us the changes that have been made.

Getting Started

So now that we have an idea of what Git is. Lets go ahead and set up Git.

Step 1: Go to https://git-scm.com/downloads (This will bring you to the downloads section of Git).

Step 2: Click on your OS that your computer runs whether it be Mac , Windows, or Linux.

After Installing Git you want to set up your Identity with Git. Open up the terminal and input the following commands.

This information will not be used to login to anything. It enables Git to label all the changes you have made on the files and at what time.

Now that you have Git all set up, lets start using Git to track our changes. First, within the terminal, navigate to the directory you would like to start tracking or create one. Then run the following command to start tracking your file.

This photo was taken from Git’s page

Now that we are tracking changes made to a specific directory/file. We can now start working on our Project! There are 3 stages or sections for making your changes and saving them. Lets say you started tracking one file but you needed to add another one to go along with it. This new file will be in the first stage which is “Untracked”. This means Git see’s that you worked on a file but it does not know if you want to save the changes you make or not. To see the current status of your file simply run: git status.

Example of making changes and running git status

The next stage in Git is Staged. This is when you have added the changes made to a certain file but have not fully saved them. This is accomplished one of two ways: git add (filename here) or git add . (period is part of the command). If you include the file name in the command it will only add that file name. If you just use the period then all the files that have been changed will added to Git’s version control.

Once you have added all the changes its time to move to the third and final stage, Committed. This is the equivalent to making save/checkpoint in a video game. To accomplish this you will need to run the following command: git commit -m “insert a detailed description of the changes you made here” or you can simply type git commit and hit enter. If you choose the ladder, in the terminal you will be redirected to mock up page where you will need to hit “I” to insert a message. The message will be the same …. a detailed description of all the changes you have made. After you finish your description, simply type “:wq” to exit that screen. And BAM! All changes are saved and logged. To view the timeline of everything that has happened in the files life span, enter the command: git log . Here you can see when and who have made changes.

In conclusion, Git is a great system to help you save changes made to a project . This system tracks everything and puts a time stamp on it with who did what and when.