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

Re: git rebase -f --autosquash

From
AKAndy Kitchen <kitchen.andy@gmail.com>
Date
May 26, 2012, 07:30 UTC
Message-ID
<33DF11B90FEF4CB6B4103BE0AAF9B256@gmail.com>
In-Reply-To
<7vipfyiuv6.fsf@alter.siamese.dyndns.org>
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
Previous: Junio C HamanoNext: Vincent van Ravesteijn
Message 4 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.