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

Re: How to update a cloned git repository

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Sep 12, 2012, 08:52 UTC
Message-ID
<vpqtxv34o8a.fsf@bauges.imag.fr>
In-Reply-To
<007401cd903c$f425fc20$dc71f460$@schmitz-digital.de>
"Joachim Schmitz" <jojo@schmitz-digital.de> writes:
>> I think it is the-merge-commit^2; contrib/git-resurrect.sh might be
>> of interest, too.
>
> Sorry you lost me, this is greek to me...

A commit is an object that contain pointers to its parents. The root commit has no parent. For ordinary commits, there is one parent which is the commit on top of which it was created. For merge commits, there are N commits, the first is the one on top of which the merge was created, and the N-1 next ones are the commits being merged.

commit^ => first parent of commit commit^1 => same commit^2 => second parent, i.e. the one merged in commit.

See in git.git:
$ git show cb10ae9433126ef <---------------------------- one commit to study
commit cb10ae9433126efbc4dcc46779d7ef2fe6b1f597
Merge: 13b608a 9aeaab6   <------------------------------- list of parents
Author: Junio C Hamano <gitster@pobox.com>
Date:   Tue Sep 11 15:57:04 2012 -0700
    Merge branch 'jc/maint-blame-no-such-path' into pu
    
    * jc/maint-blame-no-such-path:
      blame: allow "blame file" in the middle of a conflicted merge
$ git show cb10ae9433126ef^1 <-------------------- "previous commit" in origin/pu
commit 13b608a063ce861929322e6bb3862b5364f3fbcf
Merge: fa17a26 bdee397
Author: Junio C Hamano <gitster@pobox.com>
Date:   Tue Sep 11 11:50:44 2012 -0700
    Merge branch 'dg/run-command-child-cleanup' into pu
    
    * dg/run-command-child-cleanup:
      run-command.c: fix broken list iteration in clear_child_for_cleanup
$ git show cb10ae9433126ef^2 <----------------- commit being merged by cb10ae9433126ef
commit 9aeaab6811dce596b4f6141d76f5300359bfd009
Author: Junio C Hamano <gitster@pobox.com>
Date:   Tue Sep 11 14:30:03 2012 -0700
    blame: allow "blame file" in the middle of a conflicted merge
[...]
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Joachim Schmitz
Message 14 of 14 in “How to update a cloned git repository”
  1. Joachim SchmitzSep 11, 2012
  2. Matthieu MoySep 11, 2012
  3. Joachim SchmitzSep 11, 2012
  4. Matthieu MoySep 11, 2012
  5. Sitaram ChamartySep 11, 2012
  6. Junio C HamanoSep 11, 2012
  7. Joachim SchmitzSep 11, 2012
  8. Matthieu MoySep 11, 2012
  9. Joachim SchmitzSep 11, 2012
  10. Erik Faye-LundSep 11, 2012
  11. Junio C HamanoSep 11, 2012
  12. Matthieu MoySep 11, 2012
  13. Joachim SchmitzSep 11, 2012
  14. Matthieu MoySep 12, 2012

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.