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

git branch <refspec>

From
ZHZenaan Harkness <zen@freedbms.net>
Date
Jun 2, 2015, 09:45 UTC
Message-ID
<CAOsGNSTtWnawxmpL7SByUBZ-XUNdDd5nKNuudGQi-S3BjCHcdg@mail.gmail.com>
<refspec> - git's guilty little secret. Let's milk the guilt.

git branch <refspec> ought work in a similar way to git fetch <refspec>

One syntax to rule them all. Or something.
I just learned how git fetch uses refspecs and how this can just as
well apply to tags to create "remote tags" (refs/rtags/remote_name/*),
finally grokking the ridiculously simple yet powerful refspec concept
- it really is generic.

And now combining two remotes such as postgresql and postgresql-xc (which share substantial code and parent commits), or (a bit out of date now, but) the openmoko-kernel and linux mainline, becomes simpler/saner when "inventing" rtags as explained here: http://stackoverflow.com/questions/22108391/git-checkout-a-remote-tag

Some remotes in this example: git://git.postgresql.org/git/postgresql.git https://github.com/postgres-x2/postgres-x2.git git://postgres-xc.git.sourceforge.net/gitroot/postgres-xc/postgres-xc

(rtags also makes it "reasonable" to store a few other related repos in the one local mirror, even when they don't share a parent commit (e.g. postgresql-docs, -website etc) - where git fetch gives a friendly little warning to this effect "warning: no common commits". Git does after all store content, so it's entirely natural for a mirror junkie to store related content in one "mirror" repo - where there are no common commits, git could auto parallelize fetch, as long as this could be ensured to be not brittle.)

This indicates some "rtags" porcelain might be in order, especially to complement --mirror (since 1.6.0) and soon "git checkout --to=path" (2.5.0). E.g. git remote rename OLDNAME NEWNAME does not auto rename refs/rtags/OLDNAME/ - thankfully there's a little warning though. Also rtags ought be recognized as tags when not fully qualified by path, for git merge <commit-ish> etc - try local tags then also rtags when searching for a tag name.

My main wishlist though is for some porcelain for "git branch <refspec>" - to my current mind that would make a lot of sense - learn one LHS:RHS concept, and apply it all over the place.

Thanks for listening, Zenaan

Next: Zenaan Harkness
Message 1 of 2 in “git branch <refspec>”
  1. Zenaan HarknessJun 2, 2015
  2. Zenaan HarknessJun 2, 2015

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.