Skip to content

Instantly share code, notes, and snippets.

@chadwhitacre
Last active February 24, 2021 21:24
Show Gist options
  • Select an option

  • Save chadwhitacre/5d2ff5f46cd0bc981b3f3b76cf891b97 to your computer and use it in GitHub Desktop.

Select an option

Save chadwhitacre/5d2ff5f46cd0bc981b3f3b76cf891b97 to your computer and use it in GitHub Desktop.
sq - squash git commits easily
#!/usr/bin/env zsh
set -euo pipefail
n=${1:-2}
msg="$(git log --format=%B -n 1 HEAD~$(( $n - 1 )))"
git reset --soft HEAD~$n && git commit -m "$msg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment