Skip to content

Instantly share code, notes, and snippets.

@woffleloffle
Created January 27, 2016 09:12
Show Gist options
  • Save woffleloffle/d8e9255e046145cbcd56 to your computer and use it in GitHub Desktop.
Save woffleloffle/d8e9255e046145cbcd56 to your computer and use it in GitHub Desktop.
Squash git commits together.

git squash alias

From here.

Run git config --global --edit and add the following under the [alias] section.

squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f"

You can now "squash" commits together by using e.g.: git squash 3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment