Re: git rebase -f --autosquash

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: git rebase -f --autosquash

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:53:49

Carlos Martín Nieto [off-list ref] writes:
    EDITOR=: git rebase -i @{u}

and maybe set an alias (I have a 'riu' alias for 'rebase -i @{u}').

I'm not saying an extra option wouldn't be useful, but there's already
ways of making git not spawn a text editor which works for all commands,
and you can even make an alias that will do precisely that.
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.

Re: git rebase -f --autosquash

From: Andy Kitchen <hidden>
Date: 2016-06-15 22:53:54

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

Re: git rebase -f --autosquash

From: Vincent van Ravesteijn <hidden>
Date: 2016-06-15 22:53:55

Op 26-5-2012 9:30, Andy Kitchen schreef:
On Tuesday, 15 May 2012 at 2:35 AM, Junio C Hamano wrote:
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help