Removing a specific commit in a git history with multiple branches?

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

My question is about a more complicated case with this story:

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

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

Is there an easy way to remove X , or should I rely on reloading all branches myself, possibly with a shell script?

+2
git branch rebase commit history
Jan 29 '14 at 9:35
source share
1 answer

Unfortunately, Git does not facilitate in this situation. First do an interactive permutation on branch D by removing commit X.

You will have the following story:

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

Then you need to reload the F-branch to B 'with:

 git rebase --onto B' BF 

(replacement captures names by their identifiers)

The result will be

  A--B'-C'-D' \ E'--F' 
+3
Jan 29 '14 at 9:44
source share



All Articles