1.使用 git rebase -i HEAD~4 命令,4表示最近4次的提交(根据自己的情况选择,不能超过总提交次数,不然报错)。然后就会出现一下页面,按 i 进入编辑模式,在最上面找到要修改的注释内容,把最前面的 pick 修改为 edit 。然后 esc 退出编辑模式,再 :wq 保存退出 。(比如把 "9a61abe 修改说明" 前面的pick 改为edit )
2. 然后出现以下页面 ,输入命令 git commit --amend
3.再次出现vim编译器模式,按 i 进入编译模式,把最上面原本的说明内容改成新的内容,然后 esc 再 :wq 退出即可
4.然后 再执行 git rebase --continue 命令,如果出现提示 successfully rebased and updated XXX 则表示修改成功, 再重新 git push 就可以修改完成,刷新gitee然后关闭重新进就可以了。
如果出现以下报错,则表示本地文件夹和仓库文件夹文件数量或者其他的有出入差距,可能是你删了一些文件或文件夹,此时可以使用 git push -f 命令强制推送,后果你也知道,团队开发的时候慎用哦!
To https://gitee.com/xxxxx/xxx
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/xxxxx//xxx'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.