git add

Stage changes so they go into the next commit

What it does

A commit does not save every changed file, only what is in the index (also called the staging area). git add puts changes there: one file, a folder, or everything at once.

This lets you build a commit from just the changes you want and leave the rest for later. The index keeps the file as it was when you ran git add: if the file changes again, stage the new edits too.

Syntax

git add <file>…
git add .

Examples

Related commands

Practise · All commands