Simple commits:
git replace --graft <TAIL_COMMIT_SHA> <TIP_COMMIT_SHA>
If tip is a merge commit:
git replace --graft <TAIL_COMMIT_SHA> <FIRST_PARENT_OF_TIP_MERGE_COMMIT_SHA> <SECOND_PARENT_OF_TIP_MERGE_COMMIT_SHA>
Then:
git filter-branch -- --all
git push --all -u --force
or git push --all -u --force-with-lease
More at https://stackoverflow.com/questions/53185269/how-to-rebase-an-entire-commit-graph/53186482#53186482