Subject: Re: squashing patches

From: Paolo Bonzini <[email-masked]>
Date: Mon, 09 Jun 2008 08:10:01 -0700

> If you want to pick several commits and squash them together, there is
> "squash".  BUT there is no equivalent for "file" currently.
> The only way to squash several patches together is with an external tool
> like your favourite text editor, which is not fun but error-prone.
> And there is no way to squash a commit (in the repo) and a patch (as file)
> together (in exactly this order). The only thing is that you could run
> sequencer twice and squash in the second move.

My feedback is in the message from the "-s theirs" thread that I CCed 
you on.

Basic points:

1) I would like a "--strategy" option for cherry-pick and for the 
sequencer's "pick";

2) What about

   mark :1
   pick a
   file b
   pick c
   squash --up-to :1

or, to specify a commit message

   mark :1
   file a
   pick b
   squash --up-to :1 -C HEAD^

or also

   mark :1
   file a
   pick b
   squash --up-to :1 -C HEAD^ -s

to merge all signoffs.  This could be done by providing a stand-alone 
git-squash command; or alternatively, it could be done in the sequencer 
and the git-squash command would simply do

   (echo 'mark :1'
    git-rev-list --reverse $1.. | sed 's,^,pick '
    echo "squash --up-to :1 $*") | git-sequencer

after some option parsing.

3) I would like a totally batch mode-of-operation, which would fail if 
user intervention was needed (the user could choose whether to not edit 
the editor, or whether to use a no-op for GIT_EDITOR).

4) I think the sequencer is an opportunity to improve some commands, 
e.g. git-cherry-pick should grow more or less the same options as 
git-sequencer's pick.

Paolo