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
Create a new repository in the current folder
git initgit— the programinit— create a repository (the .git folder)
Related commands
- git clone — Download a repository from a server with its whole history
- git add — Stage changes so they go into the next commit
- git remote — List and add remote repositories