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

Wrong, misleading error message when "branch.<name>.merge" is invalid

From
MPMatthieu Poullet <matthieu.poullet@gmail.com>
Date
Mar 11, 2009, 12:27 UTC
Message-ID
<80a0c20d0903110527s1fed1f36wf33446220f6628ac@mail.gmail.com>
Hi,

today I've tried to update a repo I haven't used for a while (see complete log below). When trying to pull changes for my remote tracking branch, I've got an error message suggesting that my config was wrong instead of suggesting that this branch was gone on the remote.

As people (thanks to them) explain me on #git, fetch doesn't remove stale tracking branches, and so in this case the error message is pretty misleading. Maybe "Error: ref 'refs/heads/omap3' does not exist in remote repo 'origin'" (suggested by Ilari on #git) would be more appropriate?

Regards, Matthieu.

mpoullet@LU84-mpoullet:~/src/u-boot-arm$ git branch -a
* master
  omap3
  origin/20070326_ene
  origin/HEAD
  origin/master
  origin/mm
  origin/next
  origin/old-next
  origin/omap3
  origin/testing
mpoullet@LU84-mpoullet:~/src/u-boot-arm$ git pull
Already up-to-date.
mpoullet@LU84-mpoullet:~/src/u-boot-arm$ git checkout omap3
Switched to branch "omap3"
mpoullet@LU84-mpoullet:~/src/u-boot-arm$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.omap3.merge' in
your configuration file does not tell me either. Please
name which branch you want to merge on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details on the refspec.

If you often merge with the same branch, you may want to configure the following variables in your configuration file:

    branch.omap3.remote = <nickname>
    branch.omap3.merge = <remote-ref>
    remote.<nickname>.url = <url>
    remote.<nickname>.fetch = <refspec>
See git-config(1) for details.
mpoullet@LU84-mpoullet:~/src/u-boot-arm$ cat .git/config
[core]
  repositoryformatversion = 0
  filemode = true
  bare = false
  logallrefupdates = true
[remote "origin"]
  url = git://git.denx.de/u-boot-arm.git
  fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
  remote = origin
  merge = refs/heads/master
[branch "omap3"]
  remote = origin
  merge = refs/heads/omap3
Message 1 of 1 in “Wrong, misleading error message when "branch.<name>.merge" is invalid”
  1. Matthieu PoulletMar 11, 2009

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.