You cannot just override commits in a middle of a history, because sha1 of a commit depends on a parent's. So, the git doesn't know where do you want point your HEAD reference after the filtration. So, you should rewrite all up to the HEAD.
Example:
A---B---C---D---E---F master
\
\--G---H branch
if you want filter commits B and C you should also filter all commits after: D, E, F, G, H.
So, that's why git tells you to use a ref at the end of the range, so that it just not finishes up with a detached head.
After you modify B and C commits and stop will look like this:
A---B---C---D---E---F master
\ \
\ \--G---H branch
\-B'--C' (HEAD or a temporary TAG?..)
So, the master
and branch
will be untouched. I don' think this is that you want.
It means you must override all commits. The history will be then:
A---B---C---D---E---F (loose end, will be garbage collected one day)
\ \
\ \--G---H (loose end, will be garbage collected one day)
\-B'--C'--D'--E'--F' master
\
\--G'--H' branch