I did something similar a few years ago. https://github.com/ryanackley/git-html5.js . A lot of the links don't work in the README anymore. It was more of a "this would be cool!" project rather than a library I wanted everyone to use for the next 20 years. One of things that scared me is the responsibility that bugs in something like this could be catastrophic to someone's work. As I built my git library I realized a…
What you ran into is that there's nothing in the protocol itself that makes the client say "this is a forced push". The client just says "update this ref from A->B", and it's expected that it's already read the ref advertisement to see what A is, and whether it can move to A to B with --force or not.