[英]How do I completely remove a large swath of git commits?
I have a repo that looks like this: 我有一个看起来像这样的仓库:
A--B--C------F--G H--I--J--K---------O--P
\ / \ /
D--E L--M--N
I want to eliminate commits A..G. 我想消除提交A..G。 I don't care about expunging specific files or folders, I don't want to revert my commits, I want those commits to be gone from history.
我不在乎删除特定的文件或文件夹,我不想还原自己的提交,我希望这些提交不再存在。 I've tried various incantations of
filter-branches
and rebase
but I can't seem to get git to do what I want. 我尝试过各种
filter-branches
和rebase
但是我似乎无法让git做我想做的事情。
you can do interactive rebase ( rebase -i
) and squash ( s
in the interactive commit session) and then push -f
to rewrite history. 您可以进行交互式变基(
rebase -i
)和压扁(在交互式提交会话中为s
),然后push -f
重写历史记录。
Note that it will break this repository for everyone else who has this repo cloned. 请注意,它将克隆此存储库的其他所有人破坏此存储库。 They will have to re-clone, potentially losing their work in progress.
他们将不得不重新克隆,可能会丢失正在进行的工作。 So it is kind of an anti-pattern.
因此,这是一种反模式。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.