Web development
Reviewing a Commit Before Saving
Updated Oct 28, 2026
Run git status to identify changed files. Stage only the intended files with git add, then use git diff --cached to inspect the staged changes. A commit records the staged snapshot. Check for private
What you’ll learn
Learn to apply reviewing a commit before saving in a practical situation.
Explanation
Run git status to identify changed files. Stage only the intended files with git add, then use git diff --cached to inspect the staged changes. A commit records the staged snapshot. Check for private keys, passwords and unrelated edits before committing.
ប្រើ git status ដើម្បីមើលឯកសារដែលផ្លាស់ប្ដូរ។ ប្រើ git add ជ្រើសអ្វីដែលត្រូវ commit ហើយ git diff --cached ដើម្បីពិនិត្យ។ កុំរក្សាទុកពាក្យសម្ងាត់ក្នុង commit។
Worked example
Run git add index.html, then git diff --cached, then git commit -m "Add page title".
Practice
- Which changes does a normal git commit record?
- Apply the idea to an example of your own and explain your choice.
Answers and guidance
Show answers / បង្ហាញចម្លើយ
- It records the staged changes.
- Answers vary. Compare your example with the explanation and check each step.
Quick recap
Run git status to identify changed files.