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

How does git track history overwrites?

From
Jens Tröger <jens.troeger@light-speed.de>
Date
May 24, 2026, 23:41 UTC
Message-ID
<089615C1-6526-4ADC-926A-6A232F330DA2@light-speed.de>
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?

Thank you! Jens

Next: Chris Torek
Message 1 of 6 in “How does git track history overwrites?”
  1. Jens TrögerMay 24, 2026
  2. Chris TorekMay 25, 2026
  3. Junio C HamanoMay 25, 2026
  4. Jens TrögerMay 25, 2026
  5. Junio C HamanoMay 25, 2026
  6. Jens TrögerMay 25, 2026

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.