Git: Create Project

By Xah Lee. Date: . Last updated: .

To create a new project from scratch, run the following commands in terminal.

# cd to the dir containing your code
cd xx
# the directory can also be empty.

# initialize.
# This creates a .git dir in the current dir.
# This dir holds all git's data about the current project.
git init

# add all files of current dir (including subdir and files) to git staging area
git add .

# commit to local repository
git commit -m"my first commit"

The .git directory holds all git's internal data.

TIP: when using git, you should always cd to your project's directory first.