Stage & Commit Changes in Git

From the Git cheat sheet · Making Changes · verified Jul 2026

Stage & Commit Changes

Save your work to the repository history

bash
# Stage files
git add <file>
git add .              # All files
git add -A             # All including deletions
git add -p             # Interactive staging

# Commit
git commit -m "message"
git commit -am "message"  # Add + commit tracked files
git commit --amend       # Modify last commit
💡 Stage files before committing
⚠️ Amend rewrites history - don't amend pushed commits
✅ Write clear, descriptive commit messages
⚡ Use -p for selective staging

More Git tasks

Back to the full Git cheat sheet