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

Re: Script to rebase branches

From
Jeff King <peff@peff.net>
Date
May 9, 2017, 11:02 UTC
Message-ID
<20170509110249.eluxns2zz5jqh42k@sigill.intra.peff.net>
In-Reply-To
<alpine.DEB.2.21.1.1705091244420.146734@virtualbox>
On Tue, May 09, 2017 at 12:50:22PM +0200, Johannes Schindelin wrote:
Show 9 quoted lines
> > This is what I use:
> > 
> >   https://github.com/peff/git/blob/meta/rebase
> > 
> > There's no documentation in the script, but the commit message in its
> > history should give a good sense of what each part does.
> 
> That requires Meta/ to be checked out and up-to-date. I'd bet there are
> exactly two people who fall into that category.

Actually, it is not Junio's Meta that needs checked out, but rather the "meta" branch where you will find that "rebase" script. If other people find them useful, the set of scripts could perhaps be transitioned to a namespace that is appropriate to go into people's $PATH.

I didn't really expect anybody to use it verbatim, though. I was providing it more for inspiration.

> Also, I see that you do not use worktrees. Otherwise your script would
> fail.

Yes, the script predates the invention of worktrees by several years. I have occasionally played with worktrees, but don't use them extensively (I'd usually use them for a one-off change, and then remove the worktree).

Show 6 quoted lines
> When I still hoped to be able to get the rebase--helper related topic
> branches in by August last year, I had grandiose plans to teach the
> sequencer not only to perform the Git garden shears' trick (i.e. recreate
> merges), but also to optionally update local branches corresponding to the
> merge commits, including updates to the worktrees that checked them out
> (if any).

I don't think I need anything that fancy. But simply checking "is this checked out in a worktree" for each branch and then doing "cd /path/to/worktree && git rebase" instead of just "git rebase $branch" would be enough, I think.

(I'm assuming the problem you see is just that the directory running Meta/rebase cannot check out a branch that is checked out in another worktree).

-Peff
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 5 of 9 in “Script to rebase branches”
  1. Lars SchneiderMay 6, 2017
  2. Dennis KaarsemakerMay 6, 2017
  3. Jeff KingMay 9, 2017
  4. Johannes SchindelinMay 9, 2017
  5. Jeff KingMay 9, 2017
  6. Johannes SchindelinMay 9, 2017
  7. Jeff KingMay 10, 2017
  8. Junio C HamanoMay 9, 2017
  9. Jeff KingMay 10, 2017

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.