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

Interactive rebase with pre-built script?

From
Peter Krefting <peter@softwolves.pp.se>
Date
Sep 11, 2012, 06:32 UTC
Message-ID
<alpine.DEB.2.00.1209110725130.8398@ds9.cixit.se>
Hi!

At $DAYJOB, we have a lot of code flowing from a central repository to repositories which hold refinitions and ports of the code from the central repository. Often enough the people working on the porting repositories find bugs in the code from the central repository, and want to submit patches upstream.

We want to get these patches upstream in the easiest possible manner, and a clever colleague of mine came up with this recipe, to be run from the downstream repository:

   git log --reverse --format="pick %h %s" master.. -- common_paths > 
changes.txt

This gives a list of the commits changing the code in the common paths (we try to make sure to make them in separate changesets, not touching the downstream code), in a format that can be used as input to git rebase --interactive.

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. This doesn't play well if the last commit is a merge, though (making a dummy commit and just removing it from the default rebase recipe works for that case, though).

I was thinking about using git cherry-pick with a list of commits, rebase is better at helping with conflicts and such.

-- 
\\// Peter - http://www.softwolves.pp.se/
Next: Junio C Hamano
Message 1 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.