{"thread":{"id":"61723","subject":"branch{u} not working even though upstream configured","startedAt":"2024-07-03T11:58:02Z","lastAt":"2024-07-06T07:09:58Z","messageCount":2,"participants":["Stefan Haller","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"498017","messageId":"a04b3417-4590-48d1-bc6a-88ca44edb36c@haller-berlin.de","threadId":"61723","inReplyTo":null,"subject":"branch{u} not working even though upstream configured","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2024-07-03T11:52:05Z","receivedAt":"2024-07-03T11:58:02Z","isPatch":false,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"What could be a reason why branch@{u} doesn't work even though the\nbranch does have a remote tracking branch configured?\n\nWe have a user who reports the following:\n\n$ git push --set-upstream origin test-456\nbranch 'test-456' set up to track 'origin/test-456'.\nEverything up-to-date\n$ git merge-base test-456 test-456@{u}\nfatal: upstream branch 'refs/heads/test-456' not stored as a\n       remote-tracking branch\n\nGit remote shows that the remote tracking branch is configured as expected:\n\n$ git remote -v show origin\n* remote origin\n  [...]\n  Local branches configured for 'git pull':\n    test-456          merges with remote test-456\n  Local refs configured for 'git push':\n    test-456          pushes to test-456           (up to date)\n\nAny ideas?\n"},{"id":"498159","messageId":"20240706070957.GB702644@coredump.intra.peff.net","threadId":"61723","inReplyTo":"a04b3417-4590-48d1-bc6a-88ca44edb36c@haller-berlin.de","subject":"Re: branch{u} not working even though upstream configured","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2024-07-06T07:09:57Z","receivedAt":"2024-07-06T07:09:58Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Jul 03, 2024 at 01:52:05PM +0200, Stefan Haller wrote:\n\n> What could be a reason why branch@{u} doesn't work even though the\n> branch does have a remote tracking branch configured?\n> \n> We have a user who reports the following:\n> \n> $ git push --set-upstream origin test-456\n> branch 'test-456' set up to track 'origin/test-456'.\n> Everything up-to-date\n> $ git merge-base test-456 test-456@{u}\n> fatal: upstream branch 'refs/heads/test-456' not stored as a\n>        remote-tracking branch\n> \n> Git remote shows that the remote tracking branch is configured as expected:\n> \n> $ git remote -v show origin\n> * remote origin\n>   [...]\n>   Local branches configured for 'git pull':\n>     test-456          merges with remote test-456\n>   Local refs configured for 'git push':\n>     test-456          pushes to test-456           (up to date)\n> \n> Any ideas?\n\nHmm, in a simple test this seems to work for me. Can you show us what's\nin your local .git/config, especially the relevant remote and branch\nsections?  Likewise, can you show us \"git for-each-ref\" output to see\nwhat refs you have (though from the message I think we are not even\ngetting as far as looking at the remote tracking branch itself)?\n\nI was able to produce a similar error if \"refs/heads/test-456\" is not\ncovered by the remote.origin.fetch refspec. That's usually:\n\n  [remote \"origin\"]\n  fetch = +refs/heads/*:refs/remotes/origin/*\n\nbut if I delete that second line, or replace it with something like:\n\n  fetch = +refs/heads/some-specific-branch:refs/remotes/origin/some-specific-branch\n\nthen I see the same error you saw.\n\n-Peff\n"}]}