Skip to content

Unified View with the git Replace Feature

rindeal edited this page May 28, 2024 · 2 revisions

Thanks to the refs/replace/* references present only in --mirror clones or directly fetched, git generates a unified view of the historical and current branches just for you.

All the commits have original hashes, and only the so called graft commits are missing. These graft commits contain the initial import of data from previous repository, so they actually have no data itself.

This is how the unified view looks like at the replaced graft point:

commit c1de71edb35b118c3244c0d9d1b3f97c93d41969
Author: Robin H. Johnson <robbat2@gentoo.org>
Date:   Sat Aug 8 22:26:10 2015 -0700

    Update some skeleton file comments to Git instead of CVS.
    
    Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>

commit 56bd759df1d0c750a065b8c845e93d5dfa6b549d (replaced)
Author: Sebastian Pipping <sping@gentoo.org>
Date:   Sat Aug 8 17:58:28 2015 +0000

    Mask upcoming dev-libs/iniparser:4

As you can see above, the last commit of the historical repository now shows the hash of the initial (graft) commit of the new repository and is tagged as replaced. And the initial (graft) commit of the new repository is completely missing.

However, when directly referenced, the commit with original hash is still present.

git log -n1 2ebda5cd08db6bdf193adaa6de33239a83a73af0  # < hash of the last commit of the old repo
commit 2ebda5cd08db6bdf193adaa6de33239a83a73af0 (hist/by-name/cvs-repo, hist/by-date/20000728T003542Z_20150808T175828Z)
Author: Sebastian Pipping <sping@gentoo.org>
Date:   Sat Aug 8 17:58:28 2015 +0000

    Mask upcoming dev-libs/iniparser:4git log -n1 56bd759df1d0c750a065b8c845e93d5dfa6b549d  # < hash of the initial (graft) commit of the new repo
commit 56bd759df1d0c750a065b8c845e93d5dfa6b549d (replaced)
Author: Sebastian Pipping <sping@gentoo.org>
Date:   Sat Aug 8 17:58:28 2015 +0000

    Mask upcoming dev-libs/iniparser:4
Clone this wiki locally