Git: Staging Area aka “index”

  • Working Tree
  • Index / Stage / Staging Area / Cache
  • Repository

The Staging Area (also called the “index”) is where Git remembers which changes are marked to be committed. If a change is not “staged” it will not be committed. A change can be as granular as a single changed line in a file, leading to very precise commits. If, after staging a change, you decide you don’t want that change to go into the next commit, you can also “unstage” it.

Stage file: $ git add
Unstage file: $ git reset HEAD

Git Basics – Undoing Things

Removing untracked files from your git working copy
$ git clean -f

git-clean
Removing untracked files from your git working copy

Leave a Reply

Your email address will not be published. Required fields are marked *