Skip to content

Instantly share code, notes, and snippets.

@RaulTsc
Created February 20, 2017 12:02
Show Gist options
  • Save RaulTsc/4ed5daa4ec9e654df1f5f5c97ba3068d to your computer and use it in GitHub Desktop.
Save RaulTsc/4ed5daa4ec9e654df1f5f5c97ba3068d to your computer and use it in GitHub Desktop.

Squashing git commits:

  • Create new branch from master (or branch from which you've branched)

  • git checkout ROOT_BRANCH (from which you've diverged with FEATURE_BRANCH)

  • git checkout -b HELPER_BRANCH

  • git merge FEATURE_BRANCH --squash

  • git checkout ROOT BRANCH

  • git branch -D FEATURE_BRANCH

  • git checkout -b FEATURE_BRANCH

  • git merge HELPER_BRANCH

  • git branch -D HELPER_BRANCH

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