Files
dotfiles/git/dot-local/bin/git-fixup
2025-09-12 02:21:13 +02:00

20 lines
432 B
Bash
Executable File

#!/usr/bin/env bash
TARGET=$1
if [ -z "$TARGET" ]; then
if hash fzf 2>/dev/null; then
TARGET=$(git log -n 50 --pretty=format:'%h %s' --no-merges | fzf --border-label=' Select commit ' | cut -c -7 )
else
echo "Not installed: fzf"
exit -1
fi
fi
if [ -z "$TARGET" ]; then
echo "No target specified"
exit -1
fi
git commit --fixup=$TARGET ${@:2} && GIT_SEQUENCE_EDITOR=true git rebase -i --autostash --autosquash $TARGET^