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

Re: [PATCH/RFC] Convenient support of remote branches in git-checkout

From
Junio C Hamano <junkio@cox.net>
Date
Nov 7, 2006, 07:07 UTC
Message-ID
<7vlkmn7n0j.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<200611070225.24956.Josef.Weidendorfer@gmx.de>
Josef Weidendorfer <Josef.Weidendorfer@gmx.de> writes:
Show 13 quoted lines
>> Then "git checkout origin/next" would always mean "I want to
>> switch to the branch I use to hack on the branch 'next' Junio
>> has".  Do it once and you will get exactly my tip, hack on it,
>> switch out of it and then do it again and you won't lose your
>> previous work but just switch to that branch.
>
> Ah, now I understand your thinking.
> I admit it has a compelling elegance.
>
> However.
> Would it not be confusing for newbies (and not only for them) to
> first reference the remote branch with "origin/next", and afterwards, you
> get your own development branch by using the exactly same name?

In that example, the user types "git checkout origin/next". I do not think there is any confusion.

You come from git background from the era git checkout did _not_ have this magic (in other words, "today"), so you implicitly see remotes/ prefixed in front of the "origin/next" string there.

But new people do not see remotes/ prefixed there. To them, the example command line says "Now I want to be on my 'origin/next' branch", and there is nothing 'remote' about it.

The magic under discussion happens to create your 'origin/next' branch automagically from 'remotes/origin/next' when it exists, but that can be transparent to the user [*1*].

Well, your original magic did not propose it that way, but I twisted it.

[Footnote]
*1* This is in line with what I wanted to say in my earlier "if
    I were redoing git from scratch" message when I talked about
    making "remotes" less visible.
Previous: Josef Weidendorfer
Message 14 of 14 in “Convenient support of remote branches in git-checkout”
  1. Convenient support of remote branches in git-checkoutJosef Weidendorfer, Nov 6, 2006
  2. Josef WeidendorferNov 6, 2006
  3. Junio C HamanoNov 7, 2006
  4. Josef WeidendorferNov 7, 2006
  5. Junio C HamanoNov 7, 2006
  6. Junio C HamanoNov 7, 2006
  7. Josef WeidendorferNov 7, 2006
  8. Junio C HamanoNov 7, 2006
  9. Josef WeidendorferNov 7, 2006
  10. Karl HasselströmNov 7, 2006
  11. Josef WeidendorferNov 7, 2006
  12. Karl HasselströmNov 7, 2006
  13. Josef WeidendorferNov 7, 2006
  14. Junio C HamanoNov 7, 2006

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.