tj.git-extras/bin/git-abort
2022-10-06 13:26:20 +08:00

18 lines
322 B
Bash
Executable file

#!/usr/bin/env bash
gitdir="$(git rev-parse --git-dir)" || exit
opfound=
fcnt=
for i in cherry-pick merge rebase revert; do
f=${i^^}
f=${f/-/_}
test -f "${gitdir}/${f}_HEAD" && fcnt=1$fcnt && opfound=$i
done
if [ "${fcnt}" != 1 ]; then
echo "I don't know what to abort" >&2
exit 1
fi
git "${opfound}" --abort