Skip to content

Instantly share code, notes, and snippets.

@jeffremer
Created June 19, 2013 20:10
Show Gist options
  • Save jeffremer/5817616 to your computer and use it in GitHub Desktop.
Save jeffremer/5817616 to your computer and use it in GitHub Desktop.
git-squash
#!/bin/sh
source "$(git --exec-path)/git-sh-setup"
USAGE="COMMITS"
function _squash() {
if [[ $# == 1 ]]; then
if [[ -n $(git rev-parse --verify --quiet HEAD~$1) ]]; then
git rebase -i HEAD~$1
else
die "HEAD~$1 does not exist"
fi
else
usage
fi
}
_squash $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment