要从 Github 存储库中删除最后 5 次提交,您可以使用 git rebase 命令,如下所示:
查看您要修改提交历史记录的分支:
git checkout branch_name
Use the `git rebase -i HEAD~5` command to start an interactive rebase of the last 5 commits:
git rebase -i HEAD~5
This will open a text editor with a list of the last 4 commits. To delete a commit, change the word “pick” at the beginning of the line to “drop”. Save and close the file.