Kiriakos Naiskes

Posts tagged "git"

All tags

(2026-10-09) Make Magit ask for confirmation when pushing to main and master

Over the years, I have accidentally pushed to the main/master branch while believing I was on another branch. When this happened in personal projects, it was not a big deal, as I could easily fix it with a revert commit or a reset. But it was not so simple in a project where I did not have force-push rights. As a result, I added the following Elisp code to my Emacs configuration, so that I am always asked for confirmation before pushing to main/master.