Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I do not want to merge because this is the problem.

Let's say my repository looks like this: (letter's are commits)


'A' is the head. And I have two commits ('E' and 'C' that I want to get rid of). If I just remove those particular two commits, I then just get two more commits on top of the head telling me I reverted two commits. I don't want that. I want my repository to look just like the remote repository I am forked to.

The problem is I can't get any work done because every time I push a commit, it also pushes commits 'E' and 'C'.

I need help. I have done countless research and every answer I find is some abstract solution/series of commands with no explanation to them and I can't tell if it's what I need.

share|improve this question

Have you tried:

git rebase -i A

And discard the commits C and E

You might have a problem though as you have pushed them to the remote before, you can't really rewrite history if you pushed to a remote already. I mean you can, but people who have pulled after you pushed will have a problem as all of a sudden their history isn't the same as the remote history.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.