Git - Staging area (or index)

> Code - (Programming|Computer) Language > Code Versioning > Git

1 - About

(proposed next commit)

Stores information that will go into the next 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.

Advertising

3 - Command

3.1 - Add (Staging)

3.2 - Reset (Unstaging)

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

3.3 - Commit

3.4 - Remove

git rm --cached -r .

where:

  • –cached remove the paths from staging and the index without removing the files themselves
  • -r operates on directories recursively.
Advertising
code/version/git/staging_area.txt · Last modified: 2019/05/20 21:54 by gerardnico