In this section, we will dive into the staging area in Git. The staging area is where you prepare changes to be committed to the repository. It's an essential part of Git's workflow and allows you to control exactly what changes are included in each commit.
The staging area, also known as the index, is a space where Git gathers changes before committing them. It acts as a middle ground between your working directory and the repository.
// Shows modified, staged, and untracked files
git status
// Stages a specific file
git add file-name
// Stages all files in current directory
git add .
// Unstages a file but keeps changes
git reset file-name
// Interactively stage parts of a file
git add -p file-name
// Shows differences between staged files and last commit
git diff --cached
// Commits staged changes with a message
git commit -m "Commit message"