Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Open Terminal on the Mac and change directories to the repo/branch for the PR for which you are squashing commits.
  2. Enter the command: 
    git rebase -i HEAD~3
    where the number after the tilde is the number of commits for your branch. A Sublime window opens.

  3. The top n lines in the file start with the word "pick", where n is that same number of commits. Skip the first line, and then change "pick" to "squash" or "s" on each subsequent line.
  4. Save the file. Another file opens.
  5. The descriptions you entered for each commit are listed at the top of the file. Delete all but one of them. Save the file.
  6. Return to Terminal and enter the command:
    git push -f
    The PR in Github will refresh to show only one commit, with the description that you chose in Step 5.

Links