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

git merge vs git commit

From
RKRussell King <rmk@arm.linux.org.uk>
Date
Sep 9, 2008, 16:52 UTC
Message-ID
<20080909165236.GA8850@flint.arm.linux.org.uk>
Hi,

Using git 1.5.4.5, I notice that the result from git merge and git commit are different in an unexpected way.

Take the following tree:
     B---C---D---E2
    /
  -A1
    \
     F---G---H---I3
(letters represent commits, numbers represent where the references are).

Your current head is '1', and you want to merge branches '2' and '3', so you use:

	git merge 2 3
If there aren't any conflicts, you get a nice clean merge, resulting in:
     B---C---D---E2
    /             \
  -A               J1
    \             /
     F---G---H---I3

However, if you have a conflict that needs resolving, you fix it up as normal, and then use git commit. This results in:

     B---C---D---E2
    /             \
  -A---------------K1
    \             /
     F---G---H---I3

instead - an additional reference from commit 'K' back to commit 'A' which isn't present in the clean merge case.

Is this intentional, or is it a bug?
-- 
Russell King
Next: Junio C Hamano
Message 1 of 5 in “git merge vs git commit”
  1. Russell KingSep 9, 2008
  2. Junio C HamanoSep 9, 2008
  3. Miklos VajnaSep 9, 2008
  4. Junio C HamanoSep 9, 2008
  5. Matthieu MoySep 9, 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.