Command
git init
Creates or reinitializes local repository metadata. In a new repository no commit is created. -b selects the initial branch; available since Git 2.28. Use a new dedicated directory for practice.
Formal Syntax & Structure
git syntaxgit
git init [-b branch-name] [directory]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| -b branch-name | string | Initial branch name for a new repository. |
| directory | path | Target directory; defaults to current directory. |
Working Example
Example Snippetgit
git init -b main