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
* 7dcfe47 (frozen_changes) 2014-03-12 ~ FREEZE.unindexed
* 4b0c180 2014-03-12 ~ modfile
* 59a7cca 2014-03-12 ~ a deleted file
* 6bec695 (origin/master) 2014-03-11 ~ Add neat feature <(frozen_changes)
* d15a38a 2014-03-11 ~ Epic README update
* d559894 (master) 2014-03-11 ~ Important upstream change
| * 9c311fd (cool_feature) 2014-03-11 ~ Respond to CL comments
| | * 2a1eeb2 (subfeature) 2014-03-11 ~ integrate with CoolService
| | * d777af6 2014-03-11 ~ slick commenting action
| |/
| * 265803a 2014-03-11 ~ another improvement <(subfeature)
| * 6d831ac (spleen_tag) 2014-03-11 ~ Refactor spleen
| * 82e74ab 2014-03-11 ~ Add widget
|/
* d08c5b3 (bogus_noparent) 2014-03-11 ~ Wonderful beginnings <(cool_feature)
$ git squash-branch "cool squash demo"
$ git map
* 2c81508 (frozen_changes) 2014-03-22 ~ cool squash demo
* 6bec695 (origin/master) 2014-03-11 ~ Add neat feature <(frozen_changes)
* d15a38a 2014-03-11 ~ Epic README update
* d559894 (master) 2014-03-11 ~ Important upstream change
| * 9c311fd (cool_feature) 2014-03-11 ~ Respond to CL comments
| | * 2a1eeb2 (subfeature) 2014-03-11 ~ integrate with CoolService
| | * d777af6 2014-03-11 ~ slick commenting action
| |/
| * 265803a 2014-03-11 ~ another improvement <(subfeature)
| * 6d831ac (spleen_tag) 2014-03-11 ~ Refactor spleen
| * 82e74ab 2014-03-11 ~ Add widget
|/
* d08c5b3 (bogus_noparent) 2014-03-11 ~ Wonderful beginnings <(cool_feature)
SUGGESTED ALIASES
Some common short-hand aliases. Feel free to add these to your ~/.gitconfig file.
[alias]
git squash = squash-branch
SEE ALSO
CHROMIUM DEPOT_TOOLS
Part of the chromium depot_tools(1) suite. These tools are meant to assist with the development of chromium and related projects. Download the tools from here.