最佳答案
假设您是唯一在该分支上工作的人,您可以使用交互式 rebase 重写历史记录。
我建议您首先记录一些有关交互式 rebase 的信息。
git checkout feature
git rebase -i HEAD~3 # Rebase the last 3 commits
在打开的编辑器中,为commit1
设置drop
操作。保存。
然后使用 git push --force-with-lease
推送(强制)更改。
关于git - 如何删除特定分支的第一次提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69093192/