3 ms·
Disabling force push is a hack. Git does not track branch history, that a branch points to something that can somehow be merged to a branch you have is formaliz
by tinco 13y ago
Disabling force push is a hack. Git does not track branch history, that a branch points to something that can somehow be merged to a branch you have is formalized nowhere. Branches don't have hashes, they're just strings that point to commits.
You make it sound like force pushing is some sort of special operation, but it's actually just the same operation that's made with every commit. A branch is deleted, and then a new branch is made with that same name pointing to a new commit. It's just that with a normal push there's a check to see if there's a path from the previous HEAD to the new HEAD.
And another thing, it's also not directly destructive, the unreferenced commits don't immediately disappear. They just get cleaned up when git decides it's time for garbage removal. You can still check the commits out, if you know their sha.