git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git rebase -f --autosquash

From
Carlos Martín Nieto <cmn@elego.de>
Date
May 12, 2012, 11:05 UTC
Message-ID
<1336820755.3002.11.camel@centaur.lab.cmartin.tk>
In-Reply-To
<D7BE2BACB49749DB9FC37D4ACCCD008B@gmail.com>
On Sat, 2012-05-12 at 20:38 +1000, Andy Kitchen wrote:
Show 21 quoted lines
> 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
Previous: Andy KitchenNext: Junio C Hamano
Message 2 of 8 in “git rebase -f --autosquash”
  1. Andy KitchenMay 12, 2012
  2. Carlos Martín NietoMay 12, 2012
  3. Junio C HamanoMay 14, 2012
  4. Andy KitchenMay 26, 2012
  5. Vincent van RavesteijnMay 26, 2012
  6. Junio C HamanoMay 27, 2012
  7. Phil HordJun 4, 2012
  8. Junio C HamanoJun 4, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.