From: Avery Pennarun Date: Thu, 18 Feb 2010 19:45:54 GMT Subject: Is there something like a git format-patch --squash? Message-ID: <32541b131002181145w44d69e9eo150d08f34273cefb@mail.gmail.com> On Thu, Feb 18, 2010 at 1:38 PM, Avery Pennarun wrote: > On Thu, Feb 18, 2010 at 12:11 AM, Jeff King wrote: >> One simple strategy would be to squash all side-branch development into >> a single commit. > > Something like this (replace MY_START_BRANCH with your starting > branch, and do this in a clone of your repository so you don't destroy > anything by accident): > >        parent="" >        git rev-list --first-parent --reverse  | while read commit; do >                if [ -z "$parent" ]; then >                        git checkout -f $commit >                        git clean -fdx >                else >                        git diff $parent $commit | git apply --index >                        git commit -C $commit >                fi >                parent=$commit >        done In the above, in the 'else' clause, what I really wanted was something like: git format-patch --stdout --squash $parent..$commit with one big "| git am" at the end of the loop. However, format-patch seems to have no way of just producing a single patch with all the changes from a particular branch. Is there some other easy command that would do what I want? It seems like something that someone would have wanted before now. Thanks, Avery