Skip to content

Instantly share code, notes, and snippets.

@doloopwhile
Last active July 14, 2023 06:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save doloopwhile/fba6a6b4748b740f7b0a to your computer and use it in GitHub Desktop.
Save doloopwhile/fba6a6b4748b740f7b0a to your computer and use it in GitHub Desktop.
git-fixup-peco: select fixup target with peco
#!/bin/bash
set -o pipefail
set -e
HASH=$(git log --oneline | peco | cut -d " " -f 1)
if [ "$?" -ne 0 -o -z "$HASH" ]; then
exit 1
fi
git commit --fixup "$HASH" $@
# install:
# * first, install peco if needed
#
# $ mkdir -p ~/bin && cd ~/bin
# $ wget https://gist.githubusercontent.com/doloopwhile/fba6a6b4748b740f7b0a/raw/git-fixup-peco
# $ chmod +x ~/bin/git-fixup-peco
# $ git config --global alias.fp fixup-peco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment