Git TutorialLesson 7Free preview
Git Staging
This lesson is part of Git · All levels
Summary
Staging area (index) is the preparation layer between a working directory and a commit. With staging, you can compile a logical snapshot by selecting only the relevant changes for one commit. Compare the changes using git diff for work vs staging and git diff --staged for staging vs last commit.
Key points
- Staging allows for partial commits that focus on one change
- Git diff displays changes that have not been staged
- Git diff --staged displays the next commit content
- Git restore --staged <file> removes files from staging without deleting them
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.