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

Re: git remote set-head not working?

From
Jeff King <peff@peff.net>
Date
Dec 18, 2009, 16:53 UTC
Message-ID
<20091218165302.GA1746@sigill.intra.peff.net>
In-Reply-To
<76c5b8580912180825t17bfc90eq20dfc05cafa8c02e@mail.gmail.com>
On Fri, Dec 18, 2009 at 11:25:54AM -0500, Eugene Sajine wrote:
Show 14 quoted lines
> i have a repo cloned from the server with two branches master and qa.
> 
> $git remote show origin
> 
> tells me that the HEAD branch is master.
> 
> When i try to execute
> 
> $ git remote set-head origin qa
> 
> It prints nothing and "git remote show origin" still prints that HEAD
> branch is master.
> 
> Could you, please, advise if I am i missing something.

Hmm. It probably worked, but what you are being shown is a bit confusing.

"git remote show" will actually query the remote server to find where its HEAD is pointing. But "git remote set-head" is about changing your _local_ idea of where the remote head is pointing (in general, "git remote" does not change anything on the remote side. It is about managing the local configuration of your remotes).

AFAICT, there is no way to use "git remote" to query the result of your set-head. And the "show" output makes no distinction between the two.

Perhaps we should print both in "git remote show" if they differ. Something like:

   HEAD branch: qa (remote points to "master")
or
   HEAD branch (local): qa
   HEAD branch (remote): master

That would clear up the confusion of what is happening. Whether that is what you actually wanted, I don't know. If you want to be able to refer to "origin/qa" as "origin", then you're fine. But if you wanted to actually change the remote repository's idea of HEAD so that further clones will clone "qa" by default, then you can't do that with "git remote". You would have to go to the remote repository and run "git symbolic-ref", I think.

-Peff
Previous: Eugene SajineNext: Eugene Sajine
Message 2 of 7 in “git remote set-head not working?”
  1. Eugene SajineDec 18, 2009
  2. Jeff KingDec 18, 2009
  3. Eugene SajineDec 18, 2009
  4. Jay SoffianDec 18, 2009
  5. Junio C HamanoDec 18, 2009
  6. Jay SoffianDec 18, 2009
  7. Eugene SajineDec 18, 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.