When I do commit --amend, it is unsafe commit if the commit already has been pushed to remote repository.
I want to detect unsafe commit --amend by pre-commit hook and a
Another way to check if this is an --amend case, in standard shell:
--amend
git_command=$(ps -ocommand= -p $PPID) if [ -z "${git_command##git\ commit*--amend*}" ]; then echo "The original command was a: git commit --amend" exit 0 fi