Skip to content

Instantly share code, notes, and snippets.

@avidal
Last active September 30, 2025 16:51
Show Gist options
  • Select an option

  • Save avidal/f1722492f0affd90222d58e7a95ca89f to your computer and use it in GitHub Desktop.

Select an option

Save avidal/f1722492f0affd90222d58e7a95ca89f to your computer and use it in GitHub Desktop.
git-fixup fish function
# Usage: git-fixup<TAB>
# Drop this in ~/.config/fish/functions/git-fixup.fish
# Select one of your 10 most recent commits and pipe to git commit --fixup
function git-fixup
# $argv is the hash: subject, but we only want to pass the hash
set -l hash (echo "$argv" | string split ": " -m1 -f1)
git commit --fixup "$hash"
end
function _fixup_complete
# list the last 10 commits in the current repo as hash: subject
git log -n 10 --pretty=format:'%h: %s' --no-merges
end
complete -c git-fixup --no-files --keep-order --arguments '(_fixup_complete)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment