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

Re: set-upstream for existing branch...?

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
Feb 17, 2011, 08:23 UTC
Message-ID
<4D5CDB01.9070502@drmicha.warpmail.net>
In-Reply-To
<AANLkTim6HDCaeTDuEtK+3niKKoz6A3KA=m=UCr4DaY-V@mail.gmail.com>
Miles Bader venit, vidit, dixit 17.02.2011 08:24:
Show 9 quoted lines
> Hmm, on a related note, is there an obvious way to _show_ the current
> branch's upstream...?
> 
> [I mean, which just prints out "origin/master" or whatever...]
> 
> Thanks,
> 
> -miles
> 
git for-each-ref --format="%(upstream)" $(git symbolic-ref HEAD)

I can't come up with a better way of expanding @{u} without resolving the resulting refname to a SHA1. You could do

git name-rev @{u}

or similar with "describe", but that's really backwards - it first expands @{u} to a refname, then to a SHA1, and then tries to describe that SHA1 by a refname...

BTW: Please don't change "--set-upstream" light-heartedly and isolated
from other stuff. We need more consistency wrt. subcommands vs. options
vs. options taking parameters. So an incompatible change should be part
of a bigger picture. This requires some research about our current
usage, pitfalls, and the best way forward (breaking as little as
possible and achieving as much as possible).
Michael
Previous: Jay SoffianNext: knittl
Message 6 of 8 in “set-upstream for existing branch...?”
  1. Miles BaderFeb 17, 2011
  2. Jay SoffianFeb 17, 2011
  3. Miles BaderFeb 17, 2011
  4. Miles BaderFeb 17, 2011
  5. Jay SoffianFeb 17, 2011
  6. Michael J GruberFeb 17, 2011
  7. knittlFeb 17, 2011
  8. Michael J GruberFeb 17, 2011

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.