Subject: Re: git rebase -f --autosquash

From: Vincent van Ravesteijn <[email-masked]>
Date: Sat, 26 May 2012 14:53:26 +0200

Op 26-5-2012 9:30, Andy Kitchen schreef:
> 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.
> ...
> In summary, I propose:
>
> 1a)
>
> $ git rebase -f --autosquash<base>
> is made to be effectively equivalent to:
> $ EDITOR=: git rebase -i --autosquash<base>
>

I think the following one-line patch will effectively do what you want.

diff --git a/git-rebase.sh b/git-rebase.sh
index 24a2840..c4ffdcd 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -228,8 +228,9 @@ do
      -p)
          preserve_merges=t
          test -z "$interactive_rebase" && interactive_rebase=implied
          ;;
      --autosquash)
          autosquash=t
+        test -z "$interactive_rebase" && interactive_rebase=implied
          ;;
      --no-autosquash)

Vincent