How to modify comments in git: 1. Use the "git commit --amend -m" command to modify the comment content before pushing; 2. Use the "git push -f" command to modify the comment content before push Then modify the comment content.
The operating environment of this article: Windows 10 system, Git version 2.30.0, Dell G3 computer.
How to change comments in git
1. If you haven’t pushed yet, you need to modify the comments
First check your submission How many times, then execute
git rebase -i HEAD~number (how many commits do you want to modify)
Next execute, modify the comment
git commit --amend
Modify After finishing the comment, save it, execute
git rebase --continue
and finally push it. After executing
git push origin 当前分支名
2.push, modify the comment
. You can execute the above command first, and then execute it violently. The following command:
The operation is the same as above, but in the end you need to force push (the reason for doing this is to overwrite the push of the remote branch)
git push origin 当前分支名 -f
Recommended learning: " Git tutorial》
The above is the detailed content of How to change comments in git. For more information, please follow other related articles on the PHP Chinese website!