Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Jens Tröger" <jens.troeger@light-speed.de>
Cc: git@vger.kernel.org
Subject: Re: How does git track history overwrites?
Date: Mon, 25 May 2026 15:51:39 +0900	[thread overview]
Message-ID: <87se7gasn8.fsf@gitster.g> (raw)
In-Reply-To: <089615C1-6526-4ADC-926A-6A232F330DA2@light-speed.de> ("Jens Tröger"'s message of "Mon, 25 May 2026 09:41:50 +1000")

Jens Tröger <jens.troeger@light-speed.de> writes:

> Hello,
>
> I’m looking for details and some clarification on a `git fetch` behavior I observed, but can’t quite explain. More context is in this Github comment:
>
>   https://github.com/jenstroeger/python-package-template/pull/1190#discussion_r3288253713
>
> but it boils down to this:
>
>   /tmp/bla > git -c protocol.version=2 fetch origin dda8db18cfc68df532abf33b185ecd12d5b7b326 --depth=1
>
> It seems that sha dda8db1 (tag 1.20.0 previously pointed at it) was replaced due to a suspected history overwrite with fda7769 (tag 1.20.0 now points at it) and git figures that out:
>
>   ...
>
>   From https://github.com/adamchainz/blacken-docs
>   * branch dda8db18cfc68df532abf33b185ecd12d5b7b326 -> FETCH_HEAD
>
> And then:
>
>   /tmp/bla > git checkout FETCH_HEAD
>   Note: switching to 'FETCH_HEAD’
>
>   ...
>
>   HEAD is now at fda7769 Version 1.20.0
>
> And:
>
>   /tmp/bla > cat .git/HEAD 
>   fda77690955e9b63c6687d8806bafd56a526e45f
>   /tmp/bla > cat .git/FETCH_HEAD 
>   dda8db18cfc68df532abf33b185ecd12d5b7b326 'dda8db18cfc68df532abf33b185ecd12d5b7b326' of https://github.com/adamchainz/blacken-docs
>
> I’d like to understand the details some more, and how I could manually make that connection?

Where does this line in your discussion page at GitHub (which is
omitted from the post to this list) come from?

    commit fda77690955e9b63c6687d8806bafd56a526e45f (grafted, HEAD)

Are you doing anything funky with .git/info/grafts by any chance?

      parent reply	other threads:[~2026-05-25  6:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-24 23:41 How does git track history overwrites? Jens Tröger
2026-05-25  3:46 ` Chris Torek
2026-05-25  6:51 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87se7gasn8.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jens.troeger@light-speed.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox