git commit --amend -m "New commit message."
$ git commit --amend -m "New and correct message"
# with file changes
git commit --amend -m "Commit Message"
# without file changes, update only commit message
git commit --amend -m "Updated Commit Message" --no-edit
$ git commit --amend -m "New and correct message"
# for the most recent commit
git commit --amend -m "changed commits"
git push -f
# for n older commits
git rebase -i HEAD~n
# follow instuctions e.g. use r for reword to edit older commits
# removing a line means THAT COMMIT WILL BE LOST.
git rebase --continue
# solve conflicts if exist
git push -f
# git push --force-with-lease origin <branch> is safer
git checkout branch_name
git commit --amend -m "Modified message"
# if previous commit is not pushed yet
git push
# or if previous comment was pushed in a previous commit:
git push --force-with-lease branch_name
git commit --amend -m "an updated commit message"
git commit --amend
// press enter, editor would open
git commit --amend -m "New commit message for most recent commit"
git commit --amend -m 'commit message'
git commit --amend -m "new commit message"
$ git push --force-with-lease branch-name
git commit --amend -m "Updated message for the previous commit"
git commit --amend --author="soft hunt <softhunt@softhunt.net>"