From 4a8fd3b6a0ee50d056d9aea31d98b7909306b94d Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Wed, 29 Apr 2020 12:15:38 +0100 Subject: [PATCH] Add git-abort and git-continue --- bin/git-abort | 20 ++++++++++++++++++++ bin/git-continue | 16 ++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100755 bin/git-abort create mode 100755 bin/git-continue diff --git a/bin/git-abort b/bin/git-abort new file mode 100755 index 0000000..078c3da --- /dev/null +++ b/bin/git-abort @@ -0,0 +1,20 @@ +#!/bin/bash + +# Abort a rebase, merge, `am`, a cherry-pick or a revert, depending on the situation. + +if [[ -e .git/CHERRY_PICK_HEAD ]] ; then + exec git cherry-pick --abort "$@" +elif [[ -e .git/REVERT_HEAD ]] ; then + exec git revert --abort "$@" +elif [[ -e .git/rebase-apply/applying ]] ; then + exec git am --abort "$@" +elif [[ -e .git/rebase-apply ]] ; then + exec git rebase --abort "$@" +elif [[ -e .git/rebase-merge ]] ; then + exec git rebase --abort "$@" +elif [[ -e .git/MERGE_MODE ]] ; then + exec git merge --abort "$@" +else + echo git-abort: unknown state + exit -1 +fi diff --git a/bin/git-continue b/bin/git-continue new file mode 100755 index 0000000..9bebe0d --- /dev/null +++ b/bin/git-continue @@ -0,0 +1,16 @@ +#!/bin/bash + +# Continue a rebase or cherry-pick in the event of conflicts. + +if [[ -e .git/CHERRY_PICK_HEAD ]] ; then + exec git cherry-pick --continue "$@" +elif [[ -e .git/rebase-apply/applying ]] ; then + exec git rebase --continue "$@" +elif [[ -e .git/rebase-apply ]] ; then + exec git rebase --continue "$@" +elif [[ -e .git/rebase-merge ]] ; then + exec git rebase --continue "$@" +else + echo git-abort: unknown state + exit -1 +fi