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
| squash_last_n_commits() | |
| { | |
| if [ $# -ne 1 ] || [ "$1" -lt 2 ]; then | |
| echo 'squash_last_n_commits() requires a number (>1) as the only argument ("HEAD~$1")' | |
| else | |
| echo "Creating '__pre_squash__state__' tag, just in case." | |
| git tag "__pre_squash__state__" | |
| git reset --soft HEAD~$1 && | |
| git commit --edit -m"$(git log --format=%B --reverse HEAD..HEAD@{1})" | |
| if [ $? -ne 0 ]; then |
OlderNewer