【发布时间】:2017-07-31 23:01:45
【问题描述】:
我遇到了一个棘手的情况。我需要删除并重新提交一些我已经推送到 github 远程仓库的提交。但是这些提交不再是 HEAD(人们将他们的提交放在上面)。
我知道我可以还原提交,因此保留了提交历史。但要求是让错误的提交消失。
所以:
D <- other people's commit
|
C <- B and C are wrong commits! They need to be removed
| <- The changes that should be preserved from B and C will be
B <- committed on top of D
|
A <- this was the initial state
为了提供更多解释,我将 2 个不同的 GitHub 帐户用于工作/个人。我不小心使用个人 GitHub 帐户将 B 和 C 提交给公司回购。所以,我需要从非员工账户中删除这些提交
【问题讨论】:
标签: git git-commit git-remote git-reset git-revert