Skip to content

Instantly share code, notes, and snippets.

@ungerik
Last active August 2, 2023 12:34
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 ungerik/df20d661a19e06ae1f0e357df71adea1 to your computer and use it in GitHub Desktop.
Save ungerik/df20d661a19e06ae1f0e357df71adea1 to your computer and use it in GitHub Desktop.
Squashed Git Rebase
#!/bin/bash
git checkout -b temp main && git merge --squash $PR_BRANCH
# Resolve merge conflicts, then
git commit -m "my squash commit message"
git checkout $PR_BRANCH
git reset --hard temp && git push -f && git branch -D temp
#!/bin/bash
git checkout -b temp master && git merge --squash $PR_BRANCH
# Resolve merge conflicts, then
git commit -m "my squash commit message"
git checkout $PR_BRANCH
git reset --hard temp && git push -f && git branch -D temp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment