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

Re: Feature idea: git rebase --exec $CMD

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
May 23, 2012, 15:41 UTC
Message-ID
<vpqd35udhwq.fsf@bauges.imag.fr>
In-Reply-To
<nngfwar3p9z.fsf@transit.us.cray.com>
<dag@cray.com> writes:
Show 13 quoted lines
> Antonio Ospite <ospite@studenti.unina.it> writes:
>
>> I find the x/exec function in "git rebase -i" very useful, but it may
>> be tedious to edit the commit list to add something like "make test"
>> after each commit.
>
> I've taken a more general approach inspired by
> run-command-on-git-revisions at
> https://github.com/garybernhardt/dotfiles/tree/master/bin
>
> I took that and turned it into a git-run-command subcommand.  It will
> take an arbitrary command and run it on each revision specified by a
> revlist.

That's sensible too. The nice things with running commands in "git rebase" are:

* It's likely to be the place where you want to run some tests. The
  typical use-case is that you have a patch serie whose last revision
  passes tests, and you want to check that intermediate commits also do.
  At that point, you probably want to rebase against upstream too, to
  make sure you're developping against the latest revision, before
  sening a patch serie or pushing.
* if the "exec" command fails, you're likely to be exactly in the right
  place to fix it: fix the bug, run "git commit --amend", and "git
  rebase --continue".

The nice thing with your approach (as I understand it) is that it doesn't require rewritting history, and may apply to all commits in non-linear history.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: dag@cray.comNext: dag@cray.com
Message 8 of 9 in “Feature idea: git rebase --exec $CMD”
  1. Antonio OspiteMay 5, 2012
  2. Felipe ContrerasMay 5, 2012
  3. Matthieu MoyMay 6, 2012
  4. Antonio OspiteMay 6, 2012
  5. Jeff KingMay 6, 2012
  6. Matthieu MoyMay 10, 2012
  7. dag@cray.comMay 23, 2012
  8. Matthieu MoyMay 23, 2012
  9. dag@cray.comMay 23, 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.