Skip to content

Instantly share code, notes, and snippets.

@Machine-Maker
Created April 25, 2024 02:52
Show Gist options
  • Save Machine-Maker/b9f48dbdaad025c4d14b3486a975a4ae to your computer and use it in GitHub Desktop.
Save Machine-Maker/b9f48dbdaad025c4d14b3486a975a4ae to your computer and use it in GitHub Desktop.
git fixup fuzzy finding
_fix()
{
local all=()
if [[ "all" == $1 ]]; then
all=("--all")
fi
local extra=()
if [ $(git tag -l "base") ]; then
extra=("base..HEAD")
fi
if [[ -z $2 ]]; then
git commit "${all[@]}" --fixup $(git log "${extra[@]}" --pretty=format:'%h %s' --color | fzf --delimiter=" " --with-nth="2.." | cut -d ' ' -f1 | tr -d '\n')
else
git commit "${all[@]}" --fixup $2
fi
}
alias fix="_fix notall"
alias afix="_fix all"
alias grbia="git -c sequence.editor=: rebase --autosquash --interactive"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment