Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: git rebase -f --autosquash

From: Carlos Martín Nieto <hidden>
Date: 2016-06-15 22:53:49

On Sat, 2012-05-12 at 20:38 +1000, Andy Kitchen wrote:
Hi All, 

I commonly use:

git commit --fixup <commit>

to preen commits before pushing them. I can run

git rebase -i --autosquash HEAD@{upstream}

to apply these fixes, however, autosquash only
applies to interactive rebases.

Because I am sure that my fixes are applicable,
I would like to be able to non-interactively autosquash, possibly
like so:

git rebase -f --autosquash HEAD@{upstream}


Would anyone else find this feature useful?
If you're confident that an autosquash would produce the right
instructions, you can skip the editor phase by setting the EDITOR
environment variable to something that won't spawn an editor. Popular
variants are 'cat' and ':'. I prefer 'cat' because then I can see the
instruction set in the terminal and verify it's the correct one. You can
also set the rebase.autosquash config variable and then you just have to
type

    EDITOR=cat git rebase -i @{u}

or

    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.

   cmn
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help