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

Re: [PATCH] git-submodule: Remove duplicate entries during merge with conflict

From
Jens Lehmann <jens.lehmann@web.de>
Date
Jul 15, 2011, 19:27 UTC
Message-ID
<4E2094B4.3090009@web.de>
In-Reply-To
<1310668419989-6584432.post@n2.nabble.com>
Am 14.07.2011 20:33, schrieb funeeldy:
> How can new users of git submodules learn about merge conflicts?  When and
> why they occur, and how to resolve them in a way that doesn't lose commits?  

That is pretty similar to merge conflicts in regular files: They happen when you merge two branches where both sides changed the recorded submodule commit to another one (and those are not the same). The resolution can be done by finding a submodule commit that has both changes. In most cases that will be based on a merge (maybe even a fast forward) with both commits in its history.

If git finds a fast forward from the merge base to commit1 and commit2 (let's say they both are on master and newer than the merge base), the newer one is picked automatically. If git finds a single merge from which both commits are reachable, it proposes that as conflict resolution and tells you how you can stage that. Only if it doesn't find any or more than two merges, you are on your own and have to resolve the conflict manually by finding an appropriate commit.

> If I have to choose my version or their version, that isn't really a merge,
> or is it?

It would be if the merge strategy is "ours" or "theirs". But in most normal cases you would want to have both commits reachable from the merge result.

Previous: funeeldyNext: Marlene Cote
Message 12 of 14 in “git-submodule: Remove duplicate entries during merge with conflict”
  1. git-submodule: Remove duplicate entries during merge with conflictNicolas Morey-Chaisemartin, Mar 17, 2011
  2. Junio C HamanoMar 17, 2011
  3. Junio C HamanoMar 17, 2011
  4. Nicolas Morey-ChaisemartinMar 21, 2011
  5. Jens LehmannMar 21, 2011
  6. Jens LehmannMar 21, 2011
  7. Junio C HamanoMar 21, 2011
  8. Nicolas Morey-ChaisemartinMar 21, 2011
  9. Jens LehmannMar 21, 2011
  10. Nicolas Morey-ChaisemartinMar 22, 2011
  11. funeeldyJul 14, 2011
  12. Jens LehmannJul 15, 2011
  13. Marlene CoteJul 15, 2011
  14. Jens LehmannJul 15, 2011

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.