Git - Staging area (or index) - Proposed next commit


The staging area is a tree file called index that stores information (file, directory, message, …) about the next commit.

The index is like a pre-commit.

The index holds a snapshot of the content of the working tree, and it is this snapshot that is taken as the contents of the next commit.

Thus after making any changes to the working directory, and before running the commit command, you must use the add command to add any new or modified files to the index (ie staging area).



  • By default, the .git/index file
  • or the GIT_INDEX_FILE environment variable

Add (Staging)

Reset (Unstaging)

git reset --hard
# reset as the head from the root
git reset HEAD -- .



git rm --cached -r .


  • --cached remove the paths from staging and the index without removing the files themselves
  • -r operates on directories recursively.

Powered by ComboStrap