Skip to content

Instantly share code, notes, and snippets.

@poikilotherm
Created July 29, 2025 13:07
Show Gist options
  • Select an option

  • Save poikilotherm/d98f9acffc6aeb2ca808c6c07f2d9345 to your computer and use it in GitHub Desktop.

Select an option

Save poikilotherm/d98f9acffc6aeb2ca808c6c07f2d9345 to your computer and use it in GitHub Desktop.
Cherry pick and squash merge a feature branch for backporting
# feature-branch is a branch of develop-branch (so they are actually comparable)
git log --cherry --clear-decorations --oneline --no-abbrev --reverse remote/feature-branch ^remote/develop-branch | cut -f2 -d" " | git cherry-pick --stdin -n
git commit -m "chore: squash merge of cherry-picked remote/develop-branch"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment