Re: git rebase -f --autosquash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]