Create a new Git repository
The first thing you need to do when starting a new project is to initialize a new Git repository. This sets up all the configuration files needed by Git to track changes in your project.
Simply running git init
in the project directory will create a new repository. You can also specify a directory to create the repository in a different location, using git init <directory>
.
# Usage: 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