Skip to content

Instantly share code, notes, and snippets.

@donalod
Created May 25, 2020 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donalod/c9b0c276fb4ac0b1a79e38d9997dadaa to your computer and use it in GitHub Desktop.
Save donalod/c9b0c276fb4ac0b1a79e38d9997dadaa to your computer and use it in GitHub Desktop.
Squash Current Git Commits
#!/usr/bin/env bash
echo -e "Squashing last commits since push...\n"
git reset --soft HEAD~$(git log @{u}.. | grep -i commit | wc -l | tr -d ' ') && git commit -am "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment