To amend the last Git commit, you can follow these steps:
Make the necessary changes to your files in your working directory.
Stage the changes for commit by using the following command:
git add .
This command stages all changes in the current directory for the next commit.
Amend the commit using the --amend
option with the commit
command:
git commit --amend
This will open a text editor with the commit message of your previous commit. Edit the commit message if needed, and save the changes.
NOTE: If you only want to update the commit message without making any changes to the files, you can skip steps 1 and 2 and directly use the --amend
option with the commit
command.