git init

Initialize a Git repository in the current directory

This command creates an empty Git repository by setting up a new .git directory with subdirectories for objects, refs/heads, refs/tags, and template files.

An initial HEAD file pointing to the yet non-existent master branch is also created.

This command can also transform an existing unversioned project to a Git repository or initialize a new repository in an existing directory.

If you specify a project directory after git init, it will create a new directory and initialize a repository in it. For example, git init my_project will create a directory called my_project and initialize a Git repository inside of it.

You can also use the --bare flag (e.g., git init --bare) to create a repository that does not contain a working directory, which is useful for servers.