git init

Create a new repository in the current folder

What it does

git init turns an ordinary folder into a repository: it creates a hidden .git folder where git keeps the whole history and its settings. Your files stay as they are and do not go into history by themselves: stage them with git add and commit.

You run it once, when a project starts. If the project is already on GitHub or another server, you do not need git init: use git clone instead.

Syntax

git init
git init <folder>

Examples

Related commands

Practise · All commands