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.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论