I just did a
git push -f
without including the branch I intended to push and git just blasted in everything to my repo. Fortunately we could piece together the old repo without to much trouble but it would be nice if I could change a setting in git to prevent -f all or make it so I have to do it explicitly.
Anyone aware of a setting I can change for this?
You can setup a
pre-receivehook on the remote repo, that can prevent force push. You can also ensure that force push can only be done if explicitly specifying a particular branch.You can also setup your local repository to change the default behaviour of the
git pushso that it will push only the current branch: