home/git: add git-fixup-fixup script

This commit is contained in:
2024-11-13 16:32:36 +01:00
parent 61a22b96cd
commit 49f0a457e5
2 changed files with 20 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
if [ -n "${1:-}" ]; then
TARGET_COMMIT="$1"
shift
else
TARGET_COMMIT="HEAD"
fi
COMMIT_MESSAGE=$(git log -1 --pretty=format:'%s' "$TARGET_COMMIT")
if [[ $COMMIT_MESSAGE =~ ^fixup!* ]]; then
git commit -m "$COMMIT_MESSAGE" "$@"
else
git commit --fixup "$TARGET_COMMIT" "$@"
fi