git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* remote branches, and branch names in general
@ 2009-03-02 20:46 John Dlugosz
  2009-03-03  0:38 ` Jakub Narebski
  0 siblings, 1 reply; 9+ messages in thread
From: John Dlugosz @ 2009-03-02 20:46 UTC (permalink / raw
  To: git

I see the remote branches with names of the form remotes/pub/name where
pub is the nickname of the place I pull from.  To specify such branches,
must I always spell it out with the leading "remotes/", or can that be
shorted or implied somehow?  

Meanwhile, I see that branch names can be hierarchical, as I found out
when I accidently created a branch called "pub/xxx".  So I'm wondering
about the usefulness of using that for organizing topic branches based
on assigned tasks organization and the person owning that branch.

--John


TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited.
  If you received this in error, please contact the sender and delete the material from any computer.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: remote branches, and branch names in general
  2009-03-02 20:46 remote branches, and branch names in general John Dlugosz
@ 2009-03-03  0:38 ` Jakub Narebski
  2009-03-03  4:16   ` Jeff King
  0 siblings, 1 reply; 9+ messages in thread
From: Jakub Narebski @ 2009-03-03  0:38 UTC (permalink / raw
  To: John Dlugosz; +Cc: git

"John Dlugosz" <JDlugosz@TradeStation.com> writes:

> I see the remote branches with names of the form remotes/pub/name where
> pub is the nickname of the place I pull from.  To specify such branches,
> must I always spell it out with the leading "remotes/", or can that be
> shorted or implied somehow?  

You usually can omit "remotes/" prefix, and just use
"<remote>/<branch>" (or even "<remote>" for "<remote>/HEAD"). You need
it only if there is need for disambiguation.

> 
> Meanwhile, I see that branch names can be hierarchical, as I found out
> when I accidently created a branch called "pub/xxx".  So I'm wondering
> about the usefulness of using that for organizing topic branches based
> on assigned tasks organization and the person owning that branch.

Junio uses branches like 'fc/parseopt-config' (initials + feature)
in git development...

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: remote branches, and branch names in general
  2009-03-03  0:38 ` Jakub Narebski
@ 2009-03-03  4:16   ` Jeff King
  2009-03-03  8:58     ` Markus Heidelberg
  2009-03-03 15:52     ` John Dlugosz
  0 siblings, 2 replies; 9+ messages in thread
From: Jeff King @ 2009-03-03  4:16 UTC (permalink / raw
  To: Jakub Narebski; +Cc: John Dlugosz, git

On Mon, Mar 02, 2009 at 04:38:42PM -0800, Jakub Narebski wrote:

> > I see the remote branches with names of the form remotes/pub/name where
> > pub is the nickname of the place I pull from.  To specify such branches,
> > must I always spell it out with the leading "remotes/", or can that be
> > shorted or implied somehow?  
> 
> You usually can omit "remotes/" prefix, and just use
> "<remote>/<branch>" (or even "<remote>" for "<remote>/HEAD"). You need
> it only if there is need for disambiguation.

Yes. I don't know if they are documented anywhere, but the complete
lookup order is:

  $ git grep -h -A8 ref_rev_parse_rules refs.c
  const char *ref_rev_parse_rules[] = {
          "%.*s",
          "refs/%.*s",
          "refs/tags/%.*s",
          "refs/heads/%.*s",
          "refs/remotes/%.*s",
          "refs/remotes/%.*s/HEAD",
          NULL
  };

-Peff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: remote branches, and branch names in general
  2009-03-03  4:16   ` Jeff King
@ 2009-03-03  8:58     ` Markus Heidelberg
  2009-03-03  9:05       ` Jeff King
  2009-03-03 15:52     ` John Dlugosz
  1 sibling, 1 reply; 9+ messages in thread
From: Markus Heidelberg @ 2009-03-03  8:58 UTC (permalink / raw
  To: Jeff King; +Cc: Jakub Narebski, John Dlugosz, git

Jeff King, 03.03.2009:
> On Mon, Mar 02, 2009 at 04:38:42PM -0800, Jakub Narebski wrote:
> 
> > > I see the remote branches with names of the form remotes/pub/name where
> > > pub is the nickname of the place I pull from.  To specify such branches,
> > > must I always spell it out with the leading "remotes/", or can that be
> > > shorted or implied somehow?  
> > 
> > You usually can omit "remotes/" prefix, and just use
> > "<remote>/<branch>" (or even "<remote>" for "<remote>/HEAD"). You need
> > it only if there is need for disambiguation.
> 
> Yes. I don't know if they are documented anywhere, but the complete
> lookup order is:
> 
>   $ git grep -h -A8 ref_rev_parse_rules refs.c
>   const char *ref_rev_parse_rules[] = {
>           "%.*s",
>           "refs/%.*s",
>           "refs/tags/%.*s",
>           "refs/heads/%.*s",
>           "refs/remotes/%.*s",
>           "refs/remotes/%.*s/HEAD",
>           NULL
>   };

Documented in git-rev-parse -> specifying revisions.

Markus

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: remote branches, and branch names in general
  2009-03-03  8:58     ` Markus Heidelberg
@ 2009-03-03  9:05       ` Jeff King
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff King @ 2009-03-03  9:05 UTC (permalink / raw
  To: Markus Heidelberg; +Cc: Jakub Narebski, John Dlugosz, git

On Tue, Mar 03, 2009 at 09:58:55AM +0100, Markus Heidelberg wrote:

> > Yes. I don't know if they are documented anywhere, but the complete
> > lookup order is:
> > 
> >   $ git grep -h -A8 ref_rev_parse_rules refs.c
> >   const char *ref_rev_parse_rules[] = {
> >           "%.*s",
> >           "refs/%.*s",
> >           "refs/tags/%.*s",
> >           "refs/heads/%.*s",
> >           "refs/remotes/%.*s",
> >           "refs/remotes/%.*s/HEAD",
> >           NULL
> >   };
> 
> Documented in git-rev-parse -> specifying revisions.

Oh, indeed. Thanks for pointing it out.

Though I think this may be part of what people mean when they say git
documentation sucks. I had no idea where to look for such a thing, and
it turns out it is in the manpage for a plumbing command that in theory
I should never have to use.

-Peff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: remote branches, and branch names in general
  2009-03-03  4:16   ` Jeff King
  2009-03-03  8:58     ` Markus Heidelberg
@ 2009-03-03 15:52     ` John Dlugosz
  2009-03-03 16:11       ` Jeff King
  1 sibling, 1 reply; 9+ messages in thread
From: John Dlugosz @ 2009-03-03 15:52 UTC (permalink / raw
  To: Jeff King, Jakub Narebski; +Cc: git

===Re:===

... is need for disambiguation.

Yes. I don't know if they are documented anywhere, but the complete
lookup order is:

  $ git grep -h -A8 ref_rev_parse_rules refs.c
  const char *ref_rev_parse_rules[] = {
          "%.*s",
          "refs/%.*s",
          "refs/tags/%.*s",
          "refs/heads/%.*s",
          "refs/remotes/%.*s",
          "refs/remotes/%.*s/HEAD",
          NULL
  };
===end===

Thanks.  Indeed, it works as expected when I play around with the log command.

But I wonder if some commands work differently or specifically don't look in remotes.  I "learned" to qualify everything when I accidently created a local branch named pub/xxx instead of using remotes/pub/xxx like I intended.  I don't remember what that was, but I'm guessing that maybe refs that are a destination are different, as you are only supposed to change your local stuff.  I think that was a "pull" command, before I had the automatic argument in the config file.

--John
(excuse the footer; it's not my idea)

TradeStation Group, Inc. is a publicly-traded holding company (NASDAQ GS: TRAD) of three operating subsidiaries, TradeStation Securities, Inc. (Member NYSE, FINRA, SIPC and NFA), TradeStation Technologies, Inc., a trading software and subscription company, and TradeStation Europe Limited, a United Kingdom, FSA-authorized introducing brokerage firm. None of these companies provides trading or investment advice, recommendations or endorsements of any kind. The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: remote branches, and branch names in general
  2009-03-03 15:52     ` John Dlugosz
@ 2009-03-03 16:11       ` Jeff King
  2009-03-03 19:32         ` Jay Soffian
  0 siblings, 1 reply; 9+ messages in thread
From: Jeff King @ 2009-03-03 16:11 UTC (permalink / raw
  To: John Dlugosz; +Cc: Jakub Narebski, git

On Tue, Mar 03, 2009 at 10:52:21AM -0500, John Dlugosz wrote:

> But I wonder if some commands work differently or specifically don't
> look in remotes.  I "learned" to qualify everything when I accidently
> created a local branch named pub/xxx instead of using remotes/pub/xxx
> like I intended.  I don't remember what that was, but I'm guessing
> that maybe refs that are a destination are different, as you are only
> supposed to change your local stuff.  I think that was a "pull"
> command, before I had the automatic argument in the config file.

Yes, the "branch" command deals only with creating things in refs/heads,
which are your local branches (similarly, "git tag" will only deal with
stuff in refs/tags). So "git branch origin/foo" will make a ref
"refs/heads/origin/foo", and "git branch -d origin/foo" will delete
"refs/heads/origin/foo", not "refs/remotes/origin/foo".

But when looking up a ref, the rules are used. So you can say:

  git branch master origin/master

which will make "refs/heads/master" from "refs/remotes/origin/master".

-Peff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: remote branches, and branch names in general
  2009-03-03 16:11       ` Jeff King
@ 2009-03-03 19:32         ` Jay Soffian
  2009-03-04 10:29           ` Jeff King
  0 siblings, 1 reply; 9+ messages in thread
From: Jay Soffian @ 2009-03-03 19:32 UTC (permalink / raw
  To: Jeff King; +Cc: John Dlugosz, Jakub Narebski, git

On Tue, Mar 3, 2009 at 11:11 AM, Jeff King <peff@peff.net> wrote:
> Yes, the "branch" command deals only with creating things in refs/heads,

Unless given -r, in which case it looks in refs/remotes, or -a, in
which case it looks in refs/heads and refs/remotes. :-)

> which are your local branches (similarly, "git tag" will only deal with
> stuff in refs/tags). So "git branch origin/foo" will make a ref
> "refs/heads/origin/foo", and "git branch -d origin/foo" will delete
> "refs/heads/origin/foo", not "refs/remotes/origin/foo".

For the latter, use git branch -d -r origin/foo. I'm not sure whether
-r is usable when creating a branch, I haven't tried.

j.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: remote branches, and branch names in general
  2009-03-03 19:32         ` Jay Soffian
@ 2009-03-04 10:29           ` Jeff King
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff King @ 2009-03-04 10:29 UTC (permalink / raw
  To: Jay Soffian; +Cc: John Dlugosz, Jakub Narebski, git

On Tue, Mar 03, 2009 at 02:32:00PM -0500, Jay Soffian wrote:

> On Tue, Mar 3, 2009 at 11:11 AM, Jeff King <peff@peff.net> wrote:
> > Yes, the "branch" command deals only with creating things in refs/heads,
> 
> Unless given -r, in which case it looks in refs/remotes, or -a, in
> which case it looks in refs/heads and refs/remotes. :-)

OK, fair enough. ;P

But I think the lesson to be learned is that there is a difference
between arbitrary ref lookup (which you might use with log, show, diff,
or even as the branching-off point for branch) and specialized commands
which assume you are working in some part of the ref hierarchy (heads,
tags, or even remotes).

-Peff

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-03-04 10:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-02 20:46 remote branches, and branch names in general John Dlugosz
2009-03-03  0:38 ` Jakub Narebski
2009-03-03  4:16   ` Jeff King
2009-03-03  8:58     ` Markus Heidelberg
2009-03-03  9:05       ` Jeff King
2009-03-03 15:52     ` John Dlugosz
2009-03-03 16:11       ` Jeff King
2009-03-03 19:32         ` Jay Soffian
2009-03-04 10:29           ` Jeff King

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).