I observed an unexpected behavior in an interactive rebase today. It was always my understanding that if I run an interactive rebase and don't change anything in the editor, it should not have any effect, but apparently that's not so (at least on a specific repo im working with which sadly I cannot share).
Lets say we have
A -> B -> C -> D <--HEAD
and I run git rebase -i A
I expect to see
pick B
pick C
pick D
but in the repo I'm working on I got
pick C
pick B
pick D
instead. If I close the editor and git does its thing, the result is:
A -> C' -> B' -> D' <--HEAD
Does anybody know what circumstances might lead to a behavior like that?
CodePudding user response:
I suspect you inspected your history by running git log
.
When your intention is to view the history of your repo (with your own human eyes, as opposed to using git log
to extract data for a script), I strongly suggest to add the --graph
option, otherwise you are "history blind" and do not see how commits are related to one another :
# a very handy command to view your repo's history:
git log --oneline --graph
# Someone once said he aliased this to 'git lol' and I stuck with it:
git config --global alias.lol "log --oneline --graph"
git lol
git lol master origin/master
git lol --all
...
You describe something you can see if your history contains a merge commit of some sort :
* D
* merged
|\
| * C
* | B
|/
* A