DEV Community

Cover image for Git-ing Started: An intro to Git
Maegan Wilson
Maegan Wilson

Posted on • Updated on

Git-ing Started: An intro to Git

Let’s talk about Git. This is the first post in a series of using git. In this post, I’m going to explain these things:

  • What is Git?
  • Why you should be using it
  • How to use it

If you'd rather watch a video than read though, you can do that right here also!

What is it Git?

Git is “Distributed version control” meaning it keeps track of changes made to files and there is a remote server somewhere else in the world that also has those changes. A common remote server is GitHub, which I will talk about in the next video, so make sure to hit that subscribe button and the bell to be notified when I post it.

Basically, it’s like track changes in Word but for files in a repository, or folder, that are stored locally and can be pushed to a remote server if needed. These files can be any type, but it works best with text files.

It’s usually used by developers to track all the changes made in source code and to collaborate on projects since it supports working on different parts of the project and merge them together. Since each computer also gets the full history of the repository, or project, the developers can also go back to another point in time and adjust things there.

Those advantages also stand for being a solo dev, so let’s talk about why you should use it.

Why you should use it?

If you’re not on a team, I still say you should be using git and here are my reasons.

  1. Allows you to see what changes are made
  2. Allows you to easily roll back changes if needed
  3. Allows you to have a backup of your developer environment if using a remote server like GitHub

How does one use git?

We’ve talked about why and what is git, but how do you actually use git? Like what software do you need and what do you do?

First off, download and install git


That’s the only “extra” piece of software you need, since git can be ran through the command line


  1. Initialize git to the repository or project folder, I’ll call it repo from here on out
  2. Create and or modify folders and files
  3. Add those files and folders to git’s staging area
  4. Commit the changes to git
  5. Push those changes if you have a remote server

All 5 of these steps have commands, so let's work through creating a basic website that has git.

Git workflow steps


Creating a folder for the project

Create a new folder, I’m going to be creating it in my ptd folder, but it could really be anywhere on your computer.

Initialize git

Now, we are going to tell git to start tracking this folder.

  1. Open the terminal app or whatever you use to access the command line
  2. Change your working directory to the folder you just created
    1. Use cd followed by the path to the directory to change your working directory
    2. cd developer/git-website
  3. in the terminal, type git init . Now git is working on this repo

Create an index.html file

Now, let’s create a simple index.html file that just shows “GIT IS THE BEST” and make sure to save it in the git-website folder

Stage the file

Since, the file has been created, we need to actually tell git to track this file and the current state of the file. To do this, we use the command git add {file path}. This will need to happen for any change you want git to store.

git add index.html adds index.html to the staging area.

You can repeat this step for as many files as you need.

Record the changes

Now, to actually tell git to record the changes that were added by committing those files. When committing files, you must specify a message.

git commit -m “Adding the index file”

Push those changes

Again, this step would only happen if a remote was setup, which we didn’t do in this video, but will do in the next one! So make sure to hit that subscribe button and the bell so you don’t mix it.

The command to push the changes is git push

You’ll repeat the git add, git commit, and git push a lot throughout the project so get used to those commands.

That’s the basics of what git is, why you should use it, and how to actually use it.

In the next post, I’ll talk about adding a remote server tool so that you can push your changes to a remote repo.

If you found the post useful, then please share with anyone you think will find this useful.

Latest comments (3)

maeganwilson_ profile image
Maegan Wilson

Awesome! Thanks for that link! I'll be sure to check it out.