Skip to content

Instantly share code, notes, and snippets.

@waffle2k
Created January 22, 2014 20:09
Show Gist options
  • Save waffle2k/8566431 to your computer and use it in GitHub Desktop.
Save waffle2k/8566431 to your computer and use it in GitHub Desktop.
Place this in your $PATH, then you'll be able to quickly rebase N number of commits with "git squash N"
#!/bin/bash
#
# This is just a wrapper for : git rebase -i HEAD~4
BACK=$1
function die {
echo "$1"
exit 1
}
if [ -z $1 ]; then
die 'You must specify an integer, representing the number of commits to squash'
fi
echo $BACK | egrep -q -e '^[0-9]+$' || die 'Supplied arg is not an integer value'
git rebase -i HEAD~${BACK}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment