--amend replaces the most recent commit with a new one. Use it to fix typos in commit messages or add forgotten files:
# Fix the commit message
git commit --amend -m "Correct message"
# Add a forgotten file to the last commit
git add forgotten.txt
git commit --amend --no-edit # keep same message
# Both: add file + change message
git add forgotten.txt
git commit --amend -m "Better message with all files"
Rule: Only amend commits that haven't been pushed yet. Amending a pushed commit rewrites history and will confuse your teammates.
The last commit has a typo in its message ("Aded" instead of "Added") and is missing styles.css. Fix both with --amend: the final message should be "Added homepage" and the commit must include both files.
Click "Run" to execute your code.