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

Re: FETCH_HEAD files and mirrored repos

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 11, 2020, 21:07 UTC
Message-ID
<xmqqimetrcay.fsf@gitster.c.googlers.com>
In-Reply-To
<20200711204849.khfbyundun7ujqzw@chatter.i7.local>
Konstantin Ryabitsev <konstantin@linuxfoundation.org> writes:
> Are there any downsides to deleting FETCH_HEAD after performing "git 
> remote update" in repos that are only used for mirrored hosting?
The only time Git itself uses FETCH_HEAD is during "git pull".

"git pull" is a two step process---it first calls "git fetch" and then calls "git merge" (or "git rebase") to integrate the fetched history with the history of your current branch. "git fetch" leaves what it got in that file, and "git pull" figures out what parameters and message to use to drive the second step. After that, FETCH_HEAD is not used by Git. If you call "git fetch" yourself, FETCH_HEAD left by that process is not used by Git itself, but you can use what is in it to manually execute the second step of what "git pull" would do.

So, unless your script depends on the presence and/or the contents of FETCH_HEAD, you can safely remove it.

Previous: Konstantin RyabitsevNext: Konstantin Ryabitsev
Message 2 of 19 in “FETCH_HEAD files and mirrored repos”
  1. Konstantin RyabitsevJul 11, 2020
  2. Junio C HamanoJul 11, 2020
  3. Konstantin RyabitsevJul 11, 2020
  4. Junio C HamanoJul 12, 2020
  5. Konstantin RyabitsevJul 12, 2020
  6. Junio C HamanoJul 12, 2020
  7. Konstantin RyabitsevJul 12, 2020
  8. Johannes SixtJul 13, 2020
  9. Junio C HamanoJul 13, 2020
  10. fetch: optionally allow disabling FETCH_HEAD updateJunio C Hamano, Jul 13, 2020
  11. Taylor BlauJul 13, 2020
  12. Junio C HamanoJul 13, 2020
  13. Konstantin RyabitsevJul 13, 2020
  14. Junio C HamanoJul 13, 2020
  15. Jeff KingJul 13, 2020
  16. Konstantin RyabitsevJul 13, 2020
  17. Jeff KingJul 13, 2020
  18. Johannes SixtJul 13, 2020
  19. Jonathan NiederJul 14, 2020

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.