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

How to get failed refs with new 'git fetch' behavior?

From
STStepan Tsymbal <stsymbal@atlassian.com>
Date
Jan 20, 2026, 06:19 UTC
Message-ID
<CAM8dTE=RciNHyyyhtprjXL22deTrzj5DKcBsSiAt0jFz6Az8JQ@mail.gmail.com>

Hello everyone, Appreciate your time and effort on developing and supporting the tool! I hope you can help me understand how to work with new behavior introduced in 2.51.

We parse output of ‘git fetch’ command in Bitbucket - in automation that synchronizes mirrors. And from the output we see what references were successfully updated and what failed.

In 0e358de (fetch: use batched reference updates) ‘git fetch’ started to use batched reference updates. Which is a great improvement by itself, and required the change in 'git fetch' output.

With git 2.50, when repositories had directory/file ref conflicts, the
errors were explicit:
    $ git fetch
    error: cannot lock ref 'refs/remotes/origin/branch_path':
     'refs/remotes/origin/branch_path/conflict' exists; cannot create
'refs/remotes/origin/branch_path'
    From /Users/stsymbal/repos/git-conflict-test/first/../first
     ! [new branch]      branch_path -> origin/branch_path  (unable to
update local ref)
    error: some local refs could not be updated; try running
     'git remote prune origin' to remove any old, conflicting branches
And git 2.51, in the same situation, no longer tells what ref failed:
    $ git fetch
    From /Users/stsymbal/repos/git-conflict-test/first/../first
     * [new branch]      branch_path -> origin/branch_path
    error: some local refs could not be updated; try running
     'git remote prune origin' to remove any old, conflicting branches

It is trivial in case of a single ref being fetched, but when fetching many refs there is no obvious way to see which one failed. For other errors there will be a single error message per ref, but not for directory/file conflict. The 'reference-transaction' hook also lists all references as committed.

Is it expected behavior moving forward? Can you suggest any workarounds to know what refs were successful / failed?

Reproducible example:
    mkdir first && cd first
    git init -b main
    git commit --allow-empty -m "initial commit"
    git clone ../first ../second
    git switch -c branch_path
    git commit --allow-empty -m "another commit"
    cd ../second
    git update-ref refs/remotes/origin/branch_path/conflict HEAD
    git fetch
Thanks!
Next: Kristoffer Haugsbakk
Message 1 of 3 in “How to get failed refs with new 'git fetch' behavior?”
  1. Stepan TsymbalJan 20, 2026
  2. Kristoffer HaugsbakkJan 20, 2026
  3. Stepan TsymbalJan 21, 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.