Git

Git is a distributed verson control system.

Squash a Pull Request

Assuming a pull request is from a branch that is X commits ahead, squash into one commit with:

  1. Determine the number X by looking at git log
  2. Replace X in the following command:
    git rebase --interactive --gpg-sign=user@domain HEAD~X
  3. This will bring up an editor with a list of commits and options on how to process them; for example:
    pick 7d68f53 Add new options
    pick fc44c33 Add log if new options are set
    pick e5b4d1d Fix whitespace
    pick 9f3740d Fix copyright
    
    # Rebase 433de9e..9f3740d onto 433de9e (4 commands)
    #
    # Commands:
    # p, pick <commit> = use commit
    # r, reword <commit> = use commit, but edit the commit message
    # e, edit <commit> = use commit, but stop for amending
    # s, squash <commit> = use commit, but meld into previous commit
    # f, fixup [-C | -c] <commit> = like "squash" but keep only the previous
    #                    commit's log message, unless -C is used, in which case
    #                    keep only this commit's message; -c is same as -C but
    #                    opens the editor
    [...]
  4. Do not change the first pick line but change the second and subsequent pick lines to squash; for example:
    pick 7d68f53 Add new options
    squash fc44c33 Add log if new options are set
    squash e5b4d1d Fix whitespace
    squash 9f3740d Fix copyright
    [...]
  5. Quit and save the editor
  6. This will bring up the editor again which will have all of the commit messages appended together. Modify/combine the messages into one coherent message, save, and quit.
  7. Force push to the branch:
    git push -f

This procedure is described in detail in the manual on git rebase:

If you want to fold two or more commits into one, replace the command "pick" for the second and subsequent commits with "squash" or "fixup".