Removing a specific commit in the git history with several branches?

I know how to remove a specific commit from the git history with git rebase --interactive.

My question concerns the more complex case with a history like this:

A--X--B--C--D
       \
         E--F

where I would like to remove the commit X. The issue is that in this case there are two or more branches with parents (B in this case) that have X in their history, so a single git rebase -i will not do the trick (at least I do not know how).

Is there a simple way to remove X, or do I have to rely on rebasing all branches on their own, possibly with a shell script?

Answers


Unfortunately Git doesn't make it easy in this situation. First do an interactive rebase on the D branch by deleting commit X.

You'll have the following history:

A--X--B
 \     \
  \      E--F
   \
     B'-C'-D'

Then you'll need to rebase the F branch onto B' with:

git rebase --onto B' B F

(replace commits names by their ids)

That will end up with

 A--B'-C'-D'
     \
       E'--F'

Need Your Help

nginx is downloading some files instead of executing them

php nginx

For some reason, my nginx installation is running some .php files properly, while doesn't.

Email - bulletproof background image

html outlook html-table html-email

I'm coding up HTML emails and am trying to get a background banner image to render somewhat correctly across Outlook 2010, 11, 13, 16. Using this currently - http://backgrounds.cm/.