Final answer:
To correct a previous commit message in Git, use the command 'git commit --amend'. This command should be used carefully as it alters the commit history. Amended commits must be force pushed if they were already pushed to a remote repository.
Step-by-step explanation:
To correct the message of a previous commit in Git, the correct command is git commit --amend. This command allows you to edit the message of the most recent commit. It is important to note that this will create a new commit with a new SHA hash, effectively replacing the old commit. You should use this command with caution, especially if the commit has already been pushed to a remote repository, as it can alter the project's history.
If you simply want to change the commit message, the command would be used as follows:
git commit --amend -m "New commit message"
After amending the commit message, you will need to force push the commit to the remote repository if it was previously pushed. This is done using:
git push origin branch-name --force