Skip to content

Instantly share code, notes, and snippets.

@aepyornis
Created December 4, 2018 21:03
Show Gist options
  • Save aepyornis/d6437dd671759cab14f6564029d6a12e to your computer and use it in GitHub Desktop.
Save aepyornis/d6437dd671759cab14f6564029d6a12e to your computer and use it in GitHub Desktop.
fixup!
function git-fixup! -a ref
if not git log --format="%H" -20 | grep -q $ref
# In theory we could rebase back to ANY commit.
# But I'm probably not going to want to unless it's a recent commit.
printf "Could not find $ref in the last 20 commits\n"
return 1
end
git commit --fixup=$ref
git rebase --interactive --autosquash "$ref~1"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment