staging area
Git's list of exactly what the next commit will contain, kept in the file .git/index; also called the index.
In more detail
It holds a complete tree, not just a list of changed names: every tracked path with the ID of the version that will be committed. git add replaces one path in it with the file as it is at that moment, so if you edit the file again the staged copy stays as it was. git commit turns the staging area into the new snapshot.
Example
git ls-files --stageRelated terms
- three areas — Git's model of where a change can be: the working tree on disk, the staging area waiting for the next commit, and the repository of recorded commits.
- git add — The command that copies a file's current content into the staging area so it will be part of the next commit.
- git commit — The command that records the staging area as a new commit whose parent is the current commit, then moves the current branch to it.
- git ls-files — A low-level command that lists the files in the staging area; with --stage it also shows each one's mode and blob ID.
- commit — A saved snapshot of the whole project in Git, together with its author, committer, time, message and a pointer to the commit before it.
- git status — The Git command that reports what is staged, what is changed but not staged, and what is untracked.
- pre-commit hook — A Git hook that runs before a commit is created and can refuse the commit, for example when it contains something shaped like a secret.
Taught in
- The Three Areas: Working Tree, Index, Repository — Advanced Git Internals & Distributed Workflows
- Staging Deliberately: status, add, add --patch — Advanced Git Internals & Distributed Workflows
- Committing, And What A Good Message Says — Advanced Git Internals & Distributed Workflows
- Reading History: log, show And diff — Advanced Git Internals & Distributed Workflows
- Ignoring Files, And The Tracked File Trap — Advanced Git Internals & Distributed Workflows
- Undoing: restore, reset, revert And stash — Advanced Git Internals & Distributed Workflows
- Amend, And The One Hard Rule — Advanced Git Internals & Distributed Workflows
- Your Python Folder And A First Program — Hands-on Python: Complete Video Course & Book
- String Indices — Hands-on Python: Complete Video Course & Book
- String Slices — Hands-on Python: Complete Video Course & Book
- Mad Libs Revisited: The Whole Program — Hands-on Python: Complete Video Course & Book
- Secret Scanning — Application Security & Threat Modeling for Engineers