From ff9cb9b3a64c67e968f14911f9363e7d2160a3b0 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 28 Jul 2023 17:47:59 +0100 Subject: [PATCH] Add retroamend script --- files/bin/git-retroamend | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 files/bin/git-retroamend diff --git a/files/bin/git-retroamend b/files/bin/git-retroamend new file mode 100755 index 0000000..0f5e615 --- /dev/null +++ b/files/bin/git-retroamend @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +# Based on https://github.com/no-gravity/git-retroamend + +set -e + +hash=$1 + +if [[ ! -v hash ]]; then + echo "Please provide hash." + exit 1 +fi + +git commit --fixup $hash + +# 'GIT_EDITOR=true' makes the rebase non-interactive +GIT_EDITOR=true git rebase -i --autosquash $hash^