- Linell Bonnette
So you're merrily programming and finally finish up that cool new thing. You fix everything up and push to GitHub for you next pull request. Boo. You based your feature branch off of a branch that doesn't match where you need it to go.
So you want A, B, C, D, and F. E shouldn't be there. How can you easily fix it?
git rebase -i HEAD~N, where
N is the number of commits you need to go back. In our case, it would be
git rebase -i HEAD~3. This will bring up a prompt that looks something like this:
All you have to do is delete the line corresponding to the commit you want to remove. Completely remove it. Then save and quit from the prompt and BOOM done. It's really that simple. Your commits will now look like this: