tj.git-extras/bin/git-abort
Przemek Kitszel b8e58ee9ba Add git-abort
New subcommand just calls git $op --abort, where $op is current git operation, like rebase
2021-07-05 23:43:39 +02:00

18 lines
315 B
Bash
Executable file

#!/usr/bin/env bash
gitdir="$(git rev-parse --git-dir)" || exit
opfound=
fcnt=
for i in cherry-pick merge rebase; 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