Create a new repository

Git, Repository · Apr 13, 2021

Initializes a new git repository, setting up all the configuration files needed by git.

  • Use git init to initialize an empty repository in the current directory.
  • Alternatively, use git init [<directory>] to initialize the repository in the specified <directory>.
  • Note: Running git init in an existing repository is safe.
  • Note: You only need to run git init once per repository.
git init [<directory>]
cd ~/my_project
git init # Initializes a repo in ~/my_project

cd ~
git init my_project # Initializes a repo in ~/my_project

More like this

  • Create a stash

    Saves the current state of the working directory and index into a new stash.

    Git, Repository · Apr 13, 2021

  • Add a commit message template

    Sets up a commit message template for the current repository.

    Git, Repository · Apr 13, 2021

  • View Git "undo" history

    Learn how to view your "undo" history using git reflog and reset your repository to a previous state.

    Git, Repository · May 21, 2023