> However, I have a PR in flight as we speak. For this particular absurd little thing the only way I can tell if my code is broken is Travis CI. Instead of having a string of commits with silly messages like `Struggling to get CI to work`, I've been force pushing. I know it's evil.
Is it to a feature branch that you own, specifically for the purpose of getting it merged into master? Then it's fine. That's what those branches are for. Force pushing is in no way evil if it is known that nobody should be messing with that branch except you (or by taking turns, or _some_ pre-established external protocol.) It's just that it's unsafe without knowing that context. (Just as I didn't know the context in which you were force pushing to begin with.)
Look, text is awfully bad at conveying tone; we've known this for decades. I'm not in any way intending to browbeat you about this. It was a minor thing spawned from a bad joke, with a weird tangent on git and monotonic updates. I don't think we disagree about anything, we're just coming at the discussion from different angles and missing each other. (It's nothing worth apologizing over!)
> Because I have no idea what the git metaphor is all about.
In this context, Git is like a forum thread. Committing to a git branch is posting a reply to another comment. This particular forum is of a more linear sort, but you've probably seen truly threaded forums where every comment can have multiple children. Reddit counts as one of those.
Editing a post is like creating a new comment and deleting the old one. Any post that was added in the interim was written with the original post in mind, so updating the original post has the power to change the context in which later posts are read. A force push in Git is like this: it says, "I know you were all working based off of the original content of these files, but I'm going to change it under your feet, and now you're going to have to rebase and handle any conflicts that fall on your head." It's a safe operation if you're the only one with access to the thread/branch, or if it's externally understood that you have the "privilege" to do so (e.g. a feature staging branch, as in Matthew's PR case, which is 100% valid and totally common, as he says). What isn't safe is to force push to "master", or any other branch which is more broadly shared between contributors.
(Again, I'm dramatizing it for effect; it was at worst worth a rueful laugh in the specific case at hand.)
At any rate, yes, there is a mathematical formalization of how version control systems like Git might work. It's called [patch theory](https://en.wikibooks.org/wiki/Understanding_Darcs/Patch_theory), and [here's a paper](https://arxiv.org/abs/1311.3903) putting it in a categorical setting.