Unstaged, uncommitted changes are lost after running "git reset --hard HEAD". Can I configure git to ask for confirmation before running this (potentially destructive) command?
put
git() {
if [ "$1" = "rebase" ] && [ "$2" = "--hard" ] && [ "$3" = "HEAD" ] ; then
echo "are you being a moron again?"
read i
if [ "$i" = "no" ]; then
command git $@
fi
fi
}
in your ${HOME}/.profile
Update: while this is one way to solve the problem, I prefer to make a branch backup when I am not entirely confident about the history rewriting operation I'm about to do. I achieve the backup by either force purshing to a WIP branch on remote or using git-branch-backup
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With