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

Re: git rebase + fuzz = possible bad merge

From
BHBenny Halevy <bhalevy@panasas.com>
Date
Mar 23, 2009, 15:36 UTC
Message-ID
<49C7AC78.5070801@panasas.com>
In-Reply-To
<49C79780.20105@panasas.com>
On Mar. 23, 2009, 16:06 +0200, Benny Halevy <bhalevy@panasas.com> wrote:
Show 11 quoted lines
> On Mar. 23, 2009, 15:54 +0200, Thomas Rast <trast@student.ethz.ch> wrote:
>> Benny Halevy wrote:
>>> I'm hitting bad merges with (non interactive) git rebase
>>> when a hunk is merged pre-maturely into an inexact match
>>> when there's fuzz.
>> [...]
>>> { for i in {1..10}; do echo fuzz $i; done; echo; cat test_file; } > fuzz_file
>> [...]
>>> git rebase --onto test_branch master^ master
>> git-am, and by extension rebase, by default doesn't take history into
>> account.  It just applies the patches "blindly".  ...

git am, in contrast to git rebase, errs on fuzz and you'll need to apply the patch manually. It might be annoying, but it'd be safer if git rebase would either stop on fuzz too or revert to using merge strategies (same as using git rebase -m) by default.

>> ...  Thus, there's no way
>> to know which series of 'line N' you really wanted it to go onto.
Well, there's the hunk header.
Benny
Show 17 quoted lines
>>
>> To avoid this issue, use the -m option to git-rebase so that it uses a
>> "real" merge.  (You can achieve similar effects for git-am with the -3
>> option.)
>>
> 
> OK. -m indeed helps and I'm certainly going to adopt it for my rebase scripts.
> git rebase -i does too, BTW.
> 
> I would expect though that the default mode for automatic rebase would be
> the strictest and safest...
> 
> Benny
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous: Benny Halevy
Message 4 of 4 in “git rebase + fuzz = possible bad merge”
  1. Benny HalevyMar 23, 2009
  2. Thomas RastMar 23, 2009
  3. Benny HalevyMar 23, 2009
  4. Benny HalevyMar 23, 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.