Local Repo Basics

Start Version Control

To start version control in the current directory use

git init

Initialize a Git repository and set the name for the initial branch to be <branch_name>.

git init -b <branch_name>

Adding files to the staging area

Add one file to the staging area

git add <filename>

Add multiple files to the staging area.

git add <filename> <filename> ...

Add all the files in the working directory that have been edited or changed to the staging area.

git add -A

Making a commit

It’s important to note that commit is both a verb and a noun. In Git, the verb to commit means to save something, and the noun (a commit) means a version of our project. So, to make a commit means to save a version of a project.

To create a new commit with a commit message.

git commit -m<message>