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
JWJosef Weidendorfer <josef.weidendorfer@gmx.de>
Date
Nov 7, 2006, 17:04 UTC
Message-ID
<200611071804.43724.Josef.Weidendorfer@gmx.de>
In-Reply-To
<20061107135609.GA32376@diana.vm.bytemark.co.uk>
On Tuesday 07 November 2006 14:56, you wrote:
> But what happens when an unexperienced user gets this conflict for the
> first time (having for the first time used two different remotes)?
> Your scheme forces her to learn two new things instead of one,
> creating the artificial barrier I mentioned above.

I give the user a warning that she has to specify a branch name herself. This does not force her to rename all her branches and go with the new naming <remote>/<remote branch>, but probably makes her do

 repo developer1, branch next => next (magic behavior)
 repo developer2, branch next => next2 (manual specification)
and perhaps rename next to next1 afterwards.

At least I do not want to type long branch names; most of the cloned repos I have do have only one remote. So I would rename the branches names created with the complex magic scheme.

Of course, another way is to be more smart with branch name parsing.
Currently, a given name is searched in
	.git/
	.git/refs/
	.git/refs/tags/
	.git/refs/heads/
	.git/refs/remotes/
	.git/refs/remotes/*/HEAD
What about adding before remotes
	.git/refs/heads/<first-part-of-current-branchname>/
and at the end
	.git/refs/remotes/<first-part-of-current-branchname>/
Ie. when on branch "origin/next", a given name "master" is
parsed as "refs/heads/origin/master" when existing?
So the parsing rule is: "With current branch X and given name Y,
search for a branch as near as possible to X which has Y as
last name component".
This would match current UI, where you have simple branch names
like "master" or "next".
With above rule, you can use "master" to refer
to "refs/heads/origin/master" in the complex model,
and for a read-only remote head "refs/heads/remotes/origin/next",
it is enough to say
	git-checkout next
to get a new local branch "refs/heads/origin/next" created
to work on.

You keep the simple UI and still get the perfect overview with eg. with "gitk --all" even in the case where you work on 10s of remote branches from multiple repository.

Previous: Karl HasselströmNext: Junio C Hamano
Message 13 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.