上QQ阅读APP看书,第一时间看更新
Creating a new repository
Next, create a directory, named hobnob, to house our project. Then, navigate inside and run git init. This will allow Git to start tracking changes to our project; a project tracked by Git is also known as a repository:
$ mkdir -p ~/projects/hobnob
$ cd ~/projects/hobnob/
$ git init
Initialised empty Git repository in ~/projects/hobnob/.git/
As we introduce new Git commands, I encourage you to read their full documentation, which you can find at https://git-scm.com/docs.
Running git init creates a .git directory, which holds all version-control-related information about the project. When we interact with Git using its CLI, all it's doing is manipulating the content of this .git directory. We usually don't have to care about the contents of the .git directory, as we can interact with Git purely through the CLI.
Because Git keeps all files under the .git directory, deleting the .git directory will delete the repository, including any history.