Created
August 7, 2013 15:52
-
-
Save waffle2k/6175374 to your computer and use it in GitHub Desktop.
For some reason, I can never remember the rebase command, yet I use it all of the time. This is handy if you're done with your commits, and you're ready to merge back into master. First, rebase all of your commits with "f" to fixup all of them before merging. This follows the convention of "1 change, 1 commit".
This file contains hidden or 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
#!/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