简体   繁体   中英

Rebasing branch on top of branch that is ahead

I am trying to understand what happens in the following situation:

  1. Branch out into FB from branch X
  2. Branch X gets new commits
  3. While being on FB, and without having made any changes on FB I now run git rebase origin/X
  4. The result is clear: FB now looks identical to X again.

But I don't really understand what happens here, does git simply replay the commits from X onto FB? Or is the reference to the base-commit simply changed?

I know that if I had made changes on FB, these commits would have been 'moved' to a new base-commit, but what happens exactly in the case where I don't make any changes on my FB?

does git simply replay the commits from X onto FB?

Yes.

If you compare this history of FB before and after the rebase you'll see the commit ids have all changed because the commits have been re-created.

The free Pro Git includes diagrams which makes this easier to follow.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM