top | item 40764210

(no title)

necessary | 1 year ago

Git hosting platforms generally have controls that allow you to prohibit force pushes on protected branches (i.e. master)

discuss

order

The_Colonel|1 year ago

This doesn't fix the problem since you still can do a lot of damage doing that on a (perhaps wrong) feature branch.

SOLAR_FIELDS|1 year ago

It certainly diminishes it significantly. Very few people are usually collaborating on the same branch together that isn’t the main branch in most orgs. So the chances of you destroying yours or someone else’s work that way is pretty low. You can also branch protect any arbitrary branch, at least on GitHub, though I’ve never been in an org that protects branches other than the main one, besides an org that used release branches. I’ve also never seen someone clobber someone else’s feature branch, though it probably does happen. Much more often people are accidentally clobbering their own branches.

The ability to rewrite history on feature branches is powerful in a good way and slots right into the way Git is philosophically designed. I would probably not be interested in removing that feature to prevent the rare case that someone footguns themselves or someone else

nickkell|1 year ago

That's where reflog comes in handy