Subject: Re: git rebase -f --autosquash

From: Andy Kitchen <[email-masked]>
Date: Sat, 26 May 2012 17:30:21 +1000

On Tuesday, 15 May 2012 at 2:35 AM, Junio C Hamano wrote:
> Given "EDITOR=: git commit args..." and "EDITOR=: git merge args..." are
> equivalent to giving "--no-edit" option to these commands, I would imagine
> "git rebase opts... --no-editor args..." would not be such a stretch.

I agree. However, I think it would be more intuitive to make --autosquash
work with -f or even just on its own in non-interactive mode.
It definitely makes sense practically and semantically to autosquash
non-interactively. Otherwise one needs to activate interactive mode
and effectively disable it in the same command which is a bit esoteric.

I am of the opinion that autosquashing is such a useful feature,
it's even worth having a separate command:

$ git fix

For generally rebuilding commits based on directives
placed in commit messages. Especially because it integrates
nicely with `git commit --fixup' as a kind of super amend. While
this can be easily added with a bit of customisation, I think
that it is generally applicable and useful enough to warrant being
a default part of git.

In summary, I propose:

1a)

$ git rebase -f --autosquash <base>
is made to be effectively equivalent to:
$ EDITOR=: git rebase -i --autosquash <base>

1b)

$ git rebase --autosquash <base>
(i.e. -f is implicit) is made to be effectively equivalent to:
$ EDITOR=: git rebase -i --autosquash <base>

3) A new command is created, for example one of:

$ git fix
$ git squash
$ git autosquash

For preening commits before pushing them upstream.

The default base for these operations would be HEAD@{upstream}

A config option could also be added to warn the user before pushing
commits with messages of the form /^fixup!/ etc.

It could also be less ad-hoc in its operation than --autosquash
currently is. For example, `git commit --fixup' could note the intended
target for the fix allowing `git fix' to operate correctly even when two
commits share the same message.

Of course as with any polite feature request, I am happy to write the
appropriate code, however not being familiar with the git code-base,
I would require some guidance.

Thank you for your time, suggestions welcomed

AK