Did you just commit some changes and forget to delete that console.log('test')
statement? Use git commit
with --amend
to edit the previous commit and --no-edit
to keep the previous commit message.
# 1. Delete the console.log
# 2. Stage the changes
git add my-file.js
# 3. Commit by updating the previous commit
git commit --amend --no-edit
Do this for local commits only. Don't amend commits that you already pushed.