开发者

Delete earlier commits in Git

I want to delete a couple of earlier commits. This is what my repo looks like now -

R----A----B---开发者_如何转开发-C----HEAD.

I want to remove commits A and C and also discard changes made by them. This is how my repo should look like -

R----B-----HEAD.

How can I do this in Git?

Thanks.


Use git rebase -i R, delete the A and C lines and save.

See Interactive Rebasing from Git Community Book and reorder commits with rebase from git ready for details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜