Forgot to add file or typo in commit message? –amend fixes last commit without creating new one.
Fix Commit Message:
git commit --amend -m "Corrected message"
Add Forgotten Files:
git add forgotten_file.js git commit --amend --no-edit # Add to last commit, keep message
⚠️ Warning: Never amend commits that are already pushed! Rewrites history = problems for team.
Safe Use: Only amend unpushed commits on your local branch.
