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

Re: Commited to wrong branch

From
Björn Steinbrink <b.steinbrink@gmx.de>
Date
Sep 15, 2009, 22:30 UTC
Message-ID
<20090915223025.GB14652@atjola.homenet>
In-Reply-To
<46a038f90909151453u5ead2eb5nebb46930a8e7277@mail.gmail.com>
On 2009.09.15 23:53:03 +0200, Martin Langhoff wrote:
Show 11 quoted lines
> 2009/9/15 Björn Steinbrink <B.Steinbrink@gmx.de>:
> > Sooner or later you'll hit a merge conflict anyway, and conflict markers
> > aren't that hard to understand, and IMHO are easier to handle than .rej
> > files, as you get to edit everything in-place.
> 
> When git's diff3 gets confused trying to use ancestry, the conflict
> markers bring completely unrelated things that belong to the history
> of the file and not to the patch at hand.
> 
> It's not about the conflict markers but somewhat nonsensical proposed
> "sides" to the resolution.

That's not git getting confused trying to use the ancestry, but git being unable to make use of the history. It has to use a fake common ancestor, as using the true common ancestor would obviously mean that you do a real merge, not a cherry-pick. Under some circumstances that can lead to quite "interesting" conflicts, yeah, but IMHO still better to deal with than those .rej files, especially when you switch to diff3 conflict marker mode (git checkout --conflict=diff3 -- file), which also contains the version of the code that the "common ancestor" has.

Show 7 quoted lines
> > Well, you likely shouldn't be using git-apply, which is plumbing, and
> > can't easily make use of the "index" information in git patches to do a
> > three-way merge instead of a "stupid" patch application. Instead use
> > git-am --3way to make git perform a three-way merge, leading to
> > conflicts instead of plain patch rejection.
> 
> Um, you got your internals wrong. git-apply is what git-am uses.

No, you didn't understand what I said. I said that _you_ shouldn't be using git-apply. That "git am" internally uses "git apply" is a totally different story. And with --3way, it doesn't even run just "git apply < patch", but uses "git apply" just to build a fake common ancestor and does a 3-way merge with git-merge-recursive.

Björn
Previous: Martin LanghoffNext: Howard Miller
Message 15 of 20 in “Commited to wrong branch”
  1. Howard MillerSep 15, 2009
  2. Martin LanghoffSep 15, 2009
  3. Howard MillerSep 15, 2009
  4. Martin LanghoffSep 15, 2009
  5. Howard MillerSep 15, 2009
  6. Martin LanghoffSep 15, 2009
  7. Howard MillerSep 15, 2009
  8. Björn SteinbrinkSep 15, 2009
  9. Howard MillerSep 15, 2009
  10. Martin LanghoffSep 15, 2009
  11. Howard MillerSep 15, 2009
  12. Björn SteinbrinkSep 15, 2009
  13. Howard MillerSep 15, 2009
  14. Martin LanghoffSep 15, 2009
  15. Björn SteinbrinkSep 15, 2009
  16. Howard MillerSep 15, 2009
  17. Howard MillerSep 15, 2009
  18. Johannes SixtSep 15, 2009
  19. Martin LanghoffSep 15, 2009
  20. Björn SteinbrinkSep 15, 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.