git-init:tldr:2664d
The command "git init --bare" is used to create a new Git repository without a working directory.
Typically, when you initialize a Git repository using "git init", a ".git" directory is created in the current working directory and this directory stores the repository data and history. It also sets up a working directory where you can modify files and track changes using Git.
In contrast, using "git init --bare" creates a repository that does not have a working directory. Instead of having a traditional working directory, it only contains the repository data and history, without any checked-out branch or modified files.
This type of repository is often used as a central repository, especially for collaborative development. It allows multiple developers to push and pull changes to and from the repository without conflicting with each other. It doesn't allow direct modifications to files in the repository, only the commit history and version control information are stored.
When using "git init --bare", Git will create a repository with a ".git" directory but without a working directory. The resulting repository can be accessed remotely via various protocols like SSH, HTTP, or Git's own protocol.