Thing can get confusing in GitHub, the popular repository where as many as 10 million developers stash code, collaborate or build off of someone else’s efforts. In that milieu, it’s easy for users to get lost and accidentally overwrite other people’s work. But that may change, as the organization announced a new feature Thursday to help administrators prevent such catastrophes.
The new Protected Branches feature, available in a few weeks, will let repository owners safeguard their source code from contributors who “force push” changes on top of certain, valuable parts of their projects.
“When it’s enabled for your repositories you’ll be able to go to the Branches tab in repository settings and protect branches,” wrote GitHub designer and product manager Ben Bleikamp in the official blog post. Once they’re ready for the fray, they can pull the trigger and let in the community.
Once you protect a branch, it cannot be overwritten or deleted. It will also use status checks to the master branch, and block any attempts at merges, if the branch is not up to date.
Although GitHub offers “undo” commands, which nix errors by reverting to an earlier version, the steps vary depending on the issue. Undo commands are also reactive measures after the changes have been committed.
In contrast, Protected Branches stops the overwriting before it happens. Together, they make for a toolbox of sorts so administrators can battle wayward issues.
Not everyone may be happy with the new feature, though. Some contributors could get frustrated by being barred from certain areas. But this type of control is essential for high-value software (like code used in business applications).
Hopefully now, no one will ever have to suffer seeing months of their critical work get vaporized.
Images courtesy of GitHub