diff --git a/site-modules/core/files/bin/git-merge-patch b/site-modules/core/files/bin/git-merge-patch index d915853..4120235 100755 --- a/site-modules/core/files/bin/git-merge-patch +++ b/site-modules/core/files/bin/git-merge-patch @@ -62,6 +62,20 @@ if [[ "$MERGE_BRANCH" != "--continue" ]]; then # git fetch + # + # Ask the user if they would like to remove the local branch if it exists locally + # + if [[ ! -z "$(git branch --list $MERGE_BRANCH)" ]]; then + while true; do + read -p "Branch '$MERGE_BRANCH' exists locally would you like to remove it? " yn + case $yn in + [Yy]* ) git branch -D "$MERGE_BRANCH"; break;; + [Nn]* ) echo "Exiting you need to remove branch '$MERGE_BRANCH' manually before merge-patching"; exit;; + * ) echo "Please answer yes or no.";; + esac + done + fi + # # Check out the merge branch from the origin #