During a git push, I know it's possible to cancel the push using the pre-push hook and exiting the script with a non-zero exit code.
Using a pre-push hook, I would like to intercept the current push, conditionally rebase, and then push the rebased tree (or the original if no rebase was needed). Is that possible?