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

Re: Why rebase with preserve merges asks for merged commits

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 21, 2008, 13:14 UTC
Message-ID
<alpine.LSU.1.00.0803211410310.4124@racer.site>
In-Reply-To
<20080321125650.GA4587@alea.gnuu.de>
Hi,
On Fri, 21 Mar 2008, Jörg Sommer wrote:
Show 16 quoted lines
> Think of the following situation:
> 
> M----------U          to-be-preserved
>  \          \
>   `--A---B---+---C    squash-and-preserve-merges
> 
> When I do a rebase M..C with preserve merges I can decide about all commits
> including U which came in with the merge.
> 
> U  pick 9604163 unrelated
> A  pick 5ef0364 SaPM-1
> B  pick 22aadcf SaPM-2
> +  pick 828f7d8 Merge branch 'to-be-preserved' into squash-and-preserve-merges
> C  pick 2a15a54 SaPM-3
> 
> Why I can decide about the commit U from the branch to-be-preserved?

Well, -p obviously does not take the commits (it takes a superset in your case) you would expect it to take. I am not sure if that is always the correct thing to assume, though.

In the short run, you can do it manually by
	$ git checkout B
	$ git rebase --onto branch1 M
	$ git merge U
	$ git cherry-pick C

Ciao, Dscho

P.S.: Oh, BTW, just as in German, you have to put the verb before a subject in an English question.

Previous: Jörg Sommer
Message 8 of 8 in “New test for preserve merges and squash”
  1. New test for preserve merges and squashJörg Sommer, Mar 20, 2008
  2. Junio C HamanoMar 20, 2008
  3. Jörg SommerMar 20, 2008
  4. Johannes SchindelinMar 20, 2008
  5. New test for rebase with preserve merges and squashJörg Sommer, Mar 20, 2008
  6. Johannes SchindelinMar 20, 2008
  7. Why rebase with preserve merges asks for merged commitsJörg Sommer, Mar 21, 2008
  8. Johannes SchindelinMar 21, 2008

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.