user11680003
user11680003

Reputation:

weird behaviour when use interactive rebasing to reoder commit

Let's say we have the following workflow:

D <- HEAD, branchB
|
C
|
B
|
o <- branchA

and I ran the git rebase -i branchA, then I reordered the commits as:

pick   D
pick   B
fixup  C

then I have sth like :

o  o
|  |
o  o
| /
o <- branchA

I'm confused, isn't that I need to get a linear line(with reordered nodes) like:

o  
|  
o 
|
o 
| 
o <- branchA

why I have a new "leaf"?

Upvotes: 0

Views: 42

Answers (1)

krisz
krisz

Reputation: 2695

rebase by default modifies the current branch, the branch that HEAD points to. Other branches are kept intact, so if you run git log --graph --all you could end up with a commit graph like that.

E.g. if you have

A--B--C--D--E (master, HEAD -> branch)

you do git rebase -i HEAD~3 and modify the commits, you get

A--B--C--D--E (master)
    \
     C'--D'--E' (HEAD -> branch)

Upvotes: 1

Related Questions