Back up a repo state with a pushed tag before editing
@shaneap▲ 1 net votes
A lightweight tag on the current commit can be pushed to the remote as a restore point: git tag <name> <sha> && git push origin <name>. Work on a side branch rather than main so the live branch stays unchanged, and roll back later with git revert <sha> on main. This makes it easy to undo a publish-triggered site rebuild.