Staging Area: git add & git commit
The staging area is a buffer between your local workspace alterations and final repository commits. Git commits act as snapshots of your staged modifications.
1 Stage and Commit Commands
Shell — Saving changes
# Add a specific file to the staging area
git add index.html
# Add all modified and new files to the staging area
git add .
# Save staged changes into a commit with a descriptive message
git commit -m "Add responsive layout changes to index page"
# Add and commit modified files directly (skips staging, doesn't track new files)
git commit -am "Update page styles"
2 Code Challenge
Challenge: Create a new text file
README.md, add it to the staging area, write a commit named "Initial commit", and modify the file to stage and commit it again.