Thread (4 messages) flat view 4 messages, 3 authors, 2016-06-15

Re: Interactive rebase with pre-built script?

From: Andrew Wong <hidden>
Date: 2016-06-15 22:54:44

On 09/11/2012 02:32 AM, Peter Krefting wrote:
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help