Created
April 25, 2024 02:52
-
-
Save Machine-Maker/b9f48dbdaad025c4d14b3486a975a4ae to your computer and use it in GitHub Desktop.
git fixup fuzzy finding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_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