Practical useKeep local tooling and private environment files out of an application checkout.
Common mistakesIgnoring does not remove already tracked files or purge leaked secrets from history. Rotate exposed credentials through the proper process.
Revert makes a new commit that undoes an existing commit. restore replaces uncommitted file contents. These are separate alternatives.
⚠ Caution: restore discards local edits; revert changes repository content and may affect future deployments.
Terminal
git log -5 --oneline
# Replace EXAMPLE_COMMIT with a reviewed real commit ID:
# git revert EXAMPLE_COMMIT
# Discard changes only after backing them up:
# git restore -- demo.html
Practical useRecover a reviewed demo change with history preserved.
Common mistakesDo not blindly reset --hard or clean -fd. restore can lose uncommitted work; revert may conflict and still needs testing.