diff --git a/git/configs/alias.gitconfig b/git/configs/alias.gitconfig deleted file mode 100644 index 444d05b..0000000 --- a/git/configs/alias.gitconfig +++ /dev/null @@ -1,2 +0,0 @@ -[alias] - fixup = "!f() { TARGET=$(git log -n 50 --pretty=format:'%h %s' --no-merges | fzf | cut -c -7 ); git commit --fixup=$TARGET ${@:2} && GIT_SEQUENCE_EDITOR=true git rebase -i --autostash --autosquash $TARGET^; }; f" diff --git a/git/configs/common.gitconfig b/git/configs/common.gitconfig index 3d77518..4a8cc4a 100644 --- a/git/configs/common.gitconfig +++ b/git/configs/common.gitconfig @@ -1,7 +1,6 @@ [include] path = ~/.dotfiles/git/configs/lfs.gitconfig path = ~/.dotfiles/git/configs/delta.gitconfig - path = ~/.dotfiles/git/configs/alias.gitconfig [push] default = simple diff --git a/git/dot-local/bin/git-fixup b/git/dot-local/bin/git-fixup new file mode 100755 index 0000000..5de88fc --- /dev/null +++ b/git/dot-local/bin/git-fixup @@ -0,0 +1,19 @@ +#!/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^