Getting Git

A comprehensive video course from git init to Git Master.

init: git init

In this video, we'll create a Git repository using git init.

By running git init we can turn a directory into a Git repository. This allows us to use Git to track changes on any of the files under the directory.

Before running the command, you'll want to create a project.

I keep all my projects in a directory called workspace, which I have an alias for.

So I can just type workspace.

You are welcome to use one of your existing directories or take a minute to create your own workspace.

Once you've navigated to your workspace, let's make a directory called Getting Git Part 1.

We can do so by running:

mkdir getting-git-part-1

And we'll change into the directory by running:

cd getting-git-part-1

Let's turn this directory into a Git repository by running:

git init

Git tells us it initialized an empty repository.

It's important to note, it's empty because the Git repository doesn't have any changes. Not because the directory is empty.

You can run git init in a directory containing files and git init will still initialize an empty repository.

You probably noticed my prompt changed after running git init. Don't worry if yours didn't, as we'll configure this in a later video.

For now, just consider this a quick way to see the current state of the repository.

You can get the same information and more by running:

git status