Re: git branch <refspec>
- From
- Zenaan Harkness <zen@freedbms.net>
- Date
- Jun 2, 2015, 10:22 UTC
- Message-ID
- <CAOsGNSQistVzM5vqueOUku9ZOR5dTOFJEtb8X1VwRezLr692Gw@mail.gmail.com>
- In-Reply-To
- <CAOsGNSTtWnawxmpL7SByUBZ-XUNdDd5nKNuudGQi-S3BjCHcdg@mail.gmail.com>
On 6/2/15, Zenaan Harkness <zen@freedbms.net> wrote:
Show 17 quoted lines
> <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
Regarding this stackoverflow article and "rtags", what I'm now doing is, for postgresql mainline "origin" and postresql-xc "pgxc" remotes: [remote "origin"] url = git://git.postgresql.org/git/postgresql.git fetch = +refs/*:refs/* fetch = +refs/*:refs/remotes/origin/* [remote "pgxc"] url = https://github.com/postgres-x2/postgres-x2.git fetch = +refs/*:refs/remotes/origin/*
so that origin is my normal --mirror, but also with origin and pgxc having everything (!) under refs/remotes/$name/*
This allows for those who want multiple related remotes in the one mirror to include 'interesting' refs from each remote in a way that does not clash, e.g. github's refs/pull/* pull requests.
This only leads to the "how to minimize typing without extra porcelain", and of course a symlink here can help: cd refs/ ln -s remotes r
or perhaps even better : ln -s remotes/* .
Using +refs/*:refs/remotes/origin/* feels better than e.g.: refs/rtags/origin/* refs/rpull/origin/* refs/rtags/pgxc/* refs/rpull/pgxc/* refs/blah?/origin/* refs/blah?/pgxc/* althogh these forms might simplify porcelain (e.g. tab completion) which needs to work with all refs of a particular 'type'.
Zenaan