To change a Git commit message after pushing, follow these steps, assuming no new commits have been made:
1. Use git log to find the commit you want to edit.
2. Run git commit –amend to modify the most recent commit message. This opens an editor where you can update the message.
3. Save and exit the editor.
4. Force push the amended commit to the remote repository using git push –force.
Example:
git commit –amend -m “New commit message”
git push –force
Be cautious when force-pushing, as it can overwrite changes others have pulled. Communicate with your team to avoid conflicts.