squash
Squash commits from the current branch into another branch. This function takes all commits from the current branch and squashes them into a single commit on the target branch. The result is not committed automatically, allowing you to review and write a commit message.
Modified from https://stackoverflow.com/a/37209562/4051181.
Usage: while on 'wip/12345', wanting to squash everything into 'feature/12345', run 'git squash feature/12345'.
Usage:
git squash feature/12345
CLI Command
git config --global alias.squash "!f() { BRANCH=`git symbolic-ref --short HEAD`; git checkout ${1}; git merge --squash $BRANCH; }; f"
.gitconfig Snippet
[alias]
squash = !f() { BRANCH=`git symbolic-ref --short HEAD`; git checkout ${1}; git merge --squash $BRANCH; }; f