diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/git-fixup | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/git-fixup b/bin/git-fixup new file mode 100755 index 0000000..a79c655 --- /dev/null +++ b/bin/git-fixup @@ -0,0 +1,17 @@ +#!/bin/bash + +if ! git commit -m 'fixup commit'; then + echo >&2 "Failed to create fixup commit; aborting." + exit 1 +fi + +deps=( $( git deps HEAD^! ) ) +if [ ${#deps[@]} != 1 ]; then + echo >&2 "Failed to find a single dependency of the fixup commit; aborting." + git reset --soft HEAD^ + exit 1 +fi + +git commit --amend --fixup=$deps + +# TODO: support optionally triggering the rebase. |