# git-squash-branch(1) Manual Page

## NAME

git-squash-branch - Takes all commits in a single branch and replaces them with a single commit.

## SYNOPSIS

    git squash-branch [-m <message>]

## DESCRIPTION

`git squash-branch` is a simple helper command. It takes all the commits on the current branch from the merge_base to HEAD, and reduces them to a single commit. The new commit will contain a summary of all the commits which were squashed, preceeded by a header message indicating that it’s the result of a squash (or the message you pass on the command line.).

Squashing branches is useful when trying to rebase-update over branches which were pushed to their upsteram (or committed by the Commit Queue), and then conflicting changes landed in upstream on top of the push/commit. If you know that your branch was committed but git-rebase-update(1) isn’t able to automatically clean it, you can squash the troublesome branch before `git rebase-update`, and then when `git rebase-update` presents the conflict, you can verify that the conflict diff is what you expected (and then skip it with `git rebase --skip`).

## OPTIONS

-m <message>
--message=<message>

  Optional message to use for the first line of the squashed commit. If omitted, it defaults to "git squash commit.".

## EXAMPLE

    $ git map
    * d0fb9c7	 (HEAD -> frozen_branch) 2014-04-10 ~ FREEZE.unindexed
    * f48f415	 2014-04-10 ~ modfile
    * 4c5b9c0	 2014-04-10 ~ a deleted file
    * f7ce1e4	 (fixit) 2014-04-10 ~ Add neat feature    <(frozen_branch)
    * 3726937	 2014-04-10 ~ Epic README update
    | * 14db2e5	 (cool_feature) 2014-04-10 ~ Respond to CL comments
    | | * ee3f972	 (subfeature) 2014-04-10 ~ integrate with CoolService
    | | * 4f9f508	 2014-04-10 ~ slick commenting action
    | |/
    | * 7d84f85	 2014-04-10 ~ another improvement    <(subfeature)
    | * 27abea4	 (spleen_tag) 2014-04-10 ~ Refactor spleen
    | * d8abe73	 2014-04-10 ~ Add widget
    |/
    * beec6f4	 (origin/master, origin/HEAD) 2014-04-10 ~ Make ReflectorImpl use mailboxes    <(cool_feature, fixit)
    * 41290e0	 2014-04-10 ~ don't use glibc-specific execinfo.h on uclibc builds
    * a76fde7	 2014-04-10 ~ [fsp] Add requestUnmount() method together with the request manager.
    * 9de7a71	 2014-04-10 ~ linux_aura: Use system configuration for middle clicking the titlebar.
    * 073b0c2	 2014-04-10 ~ ContentView->ContentViewCore in ContentViewRenderView
    * 2250f53	 2014-04-10 ~ ozone: evdev: Filter devices by path
    * 33a7a74	 2014-04-10 ~ Always output seccomp error messages to stderr
    $ git squash-branch -m 'cool squash demo'
    $ git map
    * 98e69e8	 (HEAD -> frozen_branch) 2014-04-10 ~ cool squash demo
    * f7ce1e4	 (fixit) 2014-04-10 ~ Add neat feature    <(frozen_branch)
    * 3726937	 2014-04-10 ~ Epic README update
    | * 14db2e5	 (cool_feature) 2014-04-10 ~ Respond to CL comments
    | | * ee3f972	 (subfeature) 2014-04-10 ~ integrate with CoolService
    | | * 4f9f508	 2014-04-10 ~ slick commenting action
    | |/
    | * 7d84f85	 2014-04-10 ~ another improvement    <(subfeature)
    | * 27abea4	 (spleen_tag) 2014-04-10 ~ Refactor spleen
    | * d8abe73	 2014-04-10 ~ Add widget
    |/
    * beec6f4	 (origin/master, origin/HEAD) 2014-04-10 ~ Make ReflectorImpl use mailboxes    <(cool_feature, fixit)
    * 41290e0	 2014-04-10 ~ don't use glibc-specific execinfo.h on uclibc builds
    * a76fde7	 2014-04-10 ~ [fsp] Add requestUnmount() method together with the request manager.
    * 9de7a71	 2014-04-10 ~ linux_aura: Use system configuration for middle clicking the titlebar.
    * 073b0c2	 2014-04-10 ~ ContentView->ContentViewCore in ContentViewRenderView
    * 2250f53	 2014-04-10 ~ ozone: evdev: Filter devices by path
    * 33a7a74	 2014-04-10 ~ Always output seccomp error messages to stderr

## SUGGESTED ALIASES

Some common short-hand aliases. Feel free to add these to your ~/.gitconfig file.

    [alias]
      git squash = squash-branch

## SEE ALSO

git-rebase-update(1)

## CHROMIUM DEPOT_TOOLS

Part of the chromium depot_tools(7) suite. These tools are meant to assist with the development of chromium and related projects. Download the tools from here.