Why does git rebase –onto over here only pick up 2 commits instead of 5?

0

Issue

I’m solving exercises over here: https://gitexercises.fracz.com/committer/vd7

enter image description here

We need to add commits H and I to your-master.

This is supposed to be the solution:

git rebase --onto your-master issue-555 rebase-complex

We’re basically telling git to pick up all commits between issue-555 and rebase-complex branches and place them into your-master, isn’t it?

Then this should have picked up G, F, E, H, and I in that order and placed them on top of D.

Why does this solution only pick up H and I but ignores E, F, and G?

Solution

We’re basically telling git to pick up all commits between issue-555 and rebase-complex branches and place them into your-master, isn’t it?

No, we’re telling Git to pick up all commits

  • that are reachable from rebase-complex
  • except those that are reachable from issue-555.

Keep in mind that a commit is "reachable" only by walking in the direction of the arrows in your graph, not in the opposite direction.

You can think of it as a set operation:

  • Take the set {A, B, E, H, I}
  • and subtract from it the set {A, B, E, F, G}.

Answered By – mkrieger1

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More