Master: git init
In this video, we'll take a closer look at
In reality, you probably won't use the additional options for
Instead, let's take a closer look at what
git init does.
When we used
git init, Git told us it created a
Let's list the contents of this directory by running:
ls -la .git
We see Git created several files and directories within
This directory effectively serves as a database. Git uses it to store information about the current state of the repository as well as its history.
As such, if you remove this directory, you destroy the Git repository.
Let's demonstrate this by running:
rm -rf .git
We can see my prompt changed and we receive an error when we run
.git directory will not effect any of the other files or directories. But by destroying the Git repository we lose all of the history.
It's unlikely you'll want to do this. Nonetheless, I think it's important to know how to undo commands.
So, if you ever run
git init in the wrong directory, simply remove the