Srinidhi Kaushik <shrinidhi.kaushik@xxxxxxxxx> writes: > Add a check to verify if the remote-tracking ref of the local branch is > reachable from one of its "reflog" entries; `set_ref_status_for_push` > updated to add a reject reason and disallow the forced push if the > check fails. I have to wonder (not objecting to, just wondering about) if it is a good assumption that the current branch must be where we should have seen the tip of the other side we are about to lose. I ask because when I do a large rewrite I often am on a detached HEAD most of the time, and after everything looks sensible in the rewritten result, I "checkout -B" the local branch. We could reduce the rate of false positive ("no you've not looked at what you are about to discard, so we won't let you force") by checking reflogs of all the local branches and HEAD, but that may be too much. I wonder if checking reflog entries only for HEAD (and not any of the current local branches) would be a good compromise.