I have this history:
o--o--o--o--o <- origin
\ \
x--x--x--M--x--x <- master (HEAD)At this point I would like to rebase to straighten the history, but it won't let me:
$ git rebase origin
Current branch master is up to date.However, if there were additional commits on origin, it would work as expected, i.e. all the 'x', but not 'M', would be moved on top of origin. The reason is that rebase checks whether the merge base of origin and HEAD is origin, and exits early if it is.
I would like to extend the check to also check for linear history. How can I do this most efficiently? My first try is along these lines:
test $(git rev-list origin..HEAD | wc -l) = \
$(git rev-list --no-merges origin..HEAD | wc -l)Is there a better approach?
-- Hannes