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

Git rebase using "wrong" commit

From
PAPhilip Allison <philip.allison@smoothwall.net>
Date
Oct 20, 2009, 11:26 UTC
Message-ID
<1256037982.7122.31.camel@gridbug.soton.smoothwall.net>
Hello all,
	We have a specific branch (integration/bug-fixes) which is under
continual rebase, shared amongst several developers.  The tracked
instances have "branch.integration/bug-fixes.rebase true" and
"branch.integration/bug-fixes.mergeoptions --no-ff" - this is working
well.  Individual developers merge their topic branches (in this case
bug fixes) into integration/bug-fixes and push it out.
	Occasionally, we want to release some bug fixes, but not others.  IOW,
when integration/bug-fixes comes to be rebased onto master, we wish to
preserve some of the topic branch merges, but not others.  This usually
works fine, but an issue has cropped up where there is a conflict
between two fixes, and only one of the two bug fixes has been released;
now, when we come to perform the rebase, it is not working as desired.
Output of "git log --first-parent master..integration/bug-fixes":
-----
commit 9f79ca3928d645435d1608e22297dacd2be94e3b
Merge: 2bc19f9 cd8273f
Author: Philip Allison <philip.allison@smoothwall.net>
Date:   Tue Oct 20 10:11:06 2009 +0100
    Merge branch 'bug/2' into integration/bug-fixes
    
    * bug/2:
      Unify format of files 1, 2 and 3
    
    Conflicts:
        file1
commit 2bc19f9af94e03e06fbe5a1034820c606d13c3d3
Merge: c785da2 b17a93c
Author: Philip Allison <philip.allison@smoothwall.net>
Date:   Tue Oct 20 10:07:37 2009 +0100
    Merge branch 'bug/1' into integration/bug-fixes
    
    * bug/1:
      Fix file 1
-----

bug/2 has, effectively, been merged into master; bug/1 has not; hence, there is not (on master) any equivalent change to that which was made to resolve the conflict.

"git rebase -i master" output (whilst on HEAD of integration/bug-fixes):

----- pick b17a93c Fix file 1

# Rebase cd8273f..9f79ca3 onto cd8273f -----

The trouble here is that b17a93c is the head of bug/1 - the rebase has
picked up the changes from that branch and is trying to apply them as a
fast-forward commit in the newly rebased integration/bug-fixes, instead
of trying to rebase the *merge* of bug/1 (i.e. 2bc19f9).
	The "-m" and "-p" options to rebase don't seem to be helping.  I have
tried getting rebase to "pick 2bc19f9" via -i, but that isn't working
either:

----- fatal: Commit 2bc19f9af94e03e06fbe5a1034820c606d13c3d3 is a merge but no -m option was given. Could not apply 2bc19f9... -----

Interestingly, rebase does *not* seem to be trying to recreate 9f79ca3 (or its second parent), which is the problem I was originally expecting to run into.

At the moment I don't know where to go from here, short of manually recreating the branch as I want it, which I am loathe to do. Ideas and suggestions much appreciated.

Please find attached a working copy of the repository, just before any attempted rebase.

Regards
-- 
Philip Allison
Senior Developer

SmoothWall Ltd
1 John Charles Way
Leeds LS12 6QA
United Kingdom

1 800 959 3760     (USA, Canada and North America)
0870 1 999 500     (United Kingdom)
+44 870 1 999 500  (All other countries)

SmoothWall is registered in England: 4298247

This email and any attachments transmitted with it are confidential
to the intended recipient(s) and may not be communicated to any
other person or published by any means without the permission of
SmoothWall Limited.  Any opinions stated in this message are solely
those of the author.  See: http://smoothwall.net/company/email.php
for the full text of this notice.
Next: Thomas Rast
Message 1 of 3 in “Git rebase using "wrong" commit”
  1. Philip AllisonOct 20, 2009
  2. Thomas RastOct 20, 2009
  3. Junio C HamanoOct 20, 2009

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.