Blockchains are designed in such a way that each new block contains information from the previous block. Changing a single transaction in the past on a blockchain requires doing all the work to make each subsequent block conform to the rules, something which is designed to be prohibitively expensive to do by generating unlikely random hashes with special properties. Even if someone decided to do this anyway, the protocol says that in the case of competing chains, go with the chain that has the most work put into it. So it's just not feasible for someone to rewrite history in a healthy chain with many nodes validating/mining blocks; they just can't catch up, and nobody will trust their chain.
Git commits are designed around the idea that they can be rearranged relatively freely, and rearrangements are cheap, so there's no good criteria for trusting the git history that has the most work done with it.