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

Re: Interactive rebase with pre-built script?

From
AWAndrew Wong <andrew.w-lists@sohovfx.com>
Date
Sep 12, 2012, 16:38 UTC
Message-ID
<5050BA90.2010105@sohovfx.com>
In-Reply-To
<alpine.DEB.2.00.1209110725130.8398@ds9.cixit.se>
On 09/11/2012 02:32 AM, Peter Krefting wrote:
Show 8 quoted lines
> Now, to my question. Is there an easy way to run interactive rebase on 
> the upstream branch with this recipe? The best we have come up with so 
> far is
>
>   git checkout master # the upstream branch
>   git rebase -i HEAD~
>
> and then just append everything from the generated recipe.
Instead of rebasing to "HEAD~", you should be able to do:
     git rebase -i HEAD
The default recipe should then just be "noop", and you can replace the 
whole default recipe with your recipe. This should also work even if the 
last commit was a merge.
Instead of appending your own recipe, you could also abuse the EDITOR 
environment variable.
Say your recipe is stored in a file called "my_recipe". Then, you could 
do this:
     env EDITOR="cp my_recipe" git rebase -i HEAD

But this could potentially be dangerous because if "rebase" fires up a editor for any other reason (e.g. having a "reword" or "squash" in your recipe), then the commit message will be messed up. So you need to make sure your recipe won't trigger any editor except for the recipe.

Previous: Junio C HamanoNext: Peter Krefting
Message 3 of 5 in “Interactive rebase with pre-built script?”
  1. Peter KreftingSep 11, 2012
  2. Junio C HamanoSep 11, 2012
  3. Andrew WongSep 12, 2012
  4. Peter KreftingSep 13, 2012
  5. Andrew WongSep 13, 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.