Skip to content

Instantly share code, notes, and snippets.

@mgershovitz
Last active December 15, 2019 21:44
Show Gist options
  • Save mgershovitz/4099de6278d7daa67e5c8610492fbb21 to your computer and use it in GitHub Desktop.
Save mgershovitz/4099de6278d7daa67e5c8610492fbb21 to your computer and use it in GitHub Desktop.
#!/bin/bash
function git {
if [[ "$1" = "merge" && "$@" != *"--help"* && "$@" != *"--abort"* ]]; then
git_merge_wrapper "$@";
else
command git "$@"
fi
}
function git_merge_wrapper {
command git "$@"
ret_code=$?
if [[ "$ret_code" != 0 ]]; then
command git merge --abort
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment