threads / discuss / 13421

How can I specify multiple refs on one line in the config file?

Subject: How can I specify multiple refs on one line in the config file?

## tl;dr

9 messages between May 7, 2008 and May 8, 2008.

replies: 8people: 4as markdown or json

Steve Hoelzer· May 7, 2008, 21:15 UTC · lore

How can I specify multiple refs on one line in the config file? For example, I want "git push" to push all heads and all tags by default so I tried this:

    [remote "origin"]
    	push = refs/heads/* refs/tags/*

That doesn't work, of course, but I imagine it is possible, and I just can't figure out the syntax.

Thanks, Steve

Thomas Adam· May 7, 2008, 21:33 UTC · re: Steve Hoelzer · lore

Re: How can I specify multiple refs on one line in the config file?

2008/5/7 Steve Hoelzer <shoelzer@gmail.com>:
Show 9 quoted lines
> How can I specify multiple refs on one line in the config file? For
>  example, I want "git push" to push all heads and all tags by default
>  so I tried this:
>
>     [remote "origin"]
>         push = refs/heads/* refs/tags/*
>
>  That doesn't work, of course, but I imagine it is possible, and I just
>  can't figure out the syntax.
I might be misunderstanding you, but to push tags, there's:
git push --tags
I know that's not inclusive of anything else.
-- Thomas Adam
Steve Hoelzer· May 7, 2008, 22:19 UTC · re: Thomas Adam · lore

Re: How can I specify multiple refs on one line in the config file?

On Wed, May 7, 2008 at 4:33 PM, Thomas Adam <thomas.adam22@gmail.com> wrote:
> I might be misunderstanding you, but to push tags, there's:
>
> git push --tags

True, but I only want to type "git push". No, it's not _really_ necessary, but I'd like to set it up that way so I don't have to depend on my coworkers (new git users) remembering "--tags".

Steve
Miklos Vajna· May 7, 2008, 22:27 UTC · re: Steve Hoelzer · lore

Re: How can I specify multiple refs on one line in the config file?

On Wed, May 07, 2008 at 05:19:30PM -0500, Steve Hoelzer <shoelzer@gmail.com> wrote:
Show 8 quoted lines
> On Wed, May 7, 2008 at 4:33 PM, Thomas Adam <thomas.adam22@gmail.com> wrote:
> > I might be misunderstanding you, but to push tags, there's:
> >
> > git push --tags
> 
> True, but I only want to type "git push". No, it's not _really_
> necessary, but I'd like to set it up that way so I don't have to
> depend on my coworkers (new git users) remembering "--tags".

are you sure pushing tags by default is a good idea? people regularly create local tags to mark a commit before a rebase, to mark a commit as a fix for a given bug, etc. those tags aren't interesting for others. tags which should be pushed usually rare. then you can use git push origin tag v1.0, since you know which tag you really want to push.

Thomas Adam· May 7, 2008, 22:38 UTC · re: Miklos Vajna · lore

Re: How can I specify multiple refs on one line in the config file?

2008/5/7 Miklos Vajna <vmiklos@frugalware.org>:
Show 16 quoted lines
>
> On Wed, May 07, 2008 at 05:19:30PM -0500, Steve Hoelzer <shoelzer@gmail.com> wrote:
>  > On Wed, May 7, 2008 at 4:33 PM, Thomas Adam <thomas.adam22@gmail.com> wrote:
>  > > I might be misunderstanding you, but to push tags, there's:
>  > >
>  > > git push --tags
>  >
>  > True, but I only want to type "git push". No, it's not _really_
>  > necessary, but I'd like to set it up that way so I don't have to
>  > depend on my coworkers (new git users) remembering "--tags".
>
>  are you sure pushing tags by default is a good idea? people regularly
>  create local tags to mark a commit before a rebase, to mark a commit as
>  a fix for a given bug, etc. those tags aren't interesting for others.
>  tags which should be pushed usually rare. then you can use git push
>  origin tag v1.0, since you know which tag you really want to push.

Probably not, which is why '--tags' exists in the first place. But then if you're working from a shared repository (which I am -- as are many, no doubt in a corporate environment) it's rather useful. I would find local tags though to be odd.

-- Thomas Adam
Steve Hoelzer· May 7, 2008, 23:58 UTC · re: Thomas Adam · lore

Re: How can I specify multiple refs on one line in the config file?

On Wed, May 7, 2008 at 5:38 PM, Thomas Adam <thomas.adam22@gmail.com> wrote:
Show 11 quoted lines
> 2008/5/7 Miklos Vajna <vmiklos@frugalware.org>:
>>  are you sure pushing tags by default is a good idea? people regularly
>>  create local tags to mark a commit before a rebase, to mark a commit as
>>  a fix for a given bug, etc. those tags aren't interesting for others.
>>  tags which should be pushed usually rare. then you can use git push
>>  origin tag v1.0, since you know which tag you really want to push.
>
> Probably not, which is why '--tags' exists in the first place.  But
> then if you're working from a shared repository (which I am -- as are
> many, no doubt in a corporate environment) it's rather useful.  I
> would find local tags though to be odd.
That's exactly my use case and why I asked the question.

However, now I'm reconsidering because local tags and branches are a great feature to show off git. If the default is to push all tags and branches just like a centralized VCS, it becomes an obstacle to learning how git does it -- and I think that the more people learn about git the more they will like it.

Steve
Jeff King· May 7, 2008, 22:28 UTC · re: Steve Hoelzer · lore

Re: How can I specify multiple refs on one line in the config file?

On Wed, May 07, 2008 at 04:15:47PM -0500, Steve Hoelzer wrote:
Show 9 quoted lines
> How can I specify multiple refs on one line in the config file? For
> example, I want "git push" to push all heads and all tags by default
> so I tried this:
> 
>     [remote "origin"]
>     	push = refs/heads/* refs/tags/*
> 
> That doesn't work, of course, but I imagine it is possible, and I just
> can't figure out the syntax.
I imagine it is possible, too, but not with one line. How about:
  [remote "origin"]
    push = refs/heads/*:refs/heads/*
    push = refs/tags/*:refs/tags/*
-Peff
Jeff King· May 7, 2008, 22:29 UTC · re: Jeff King · lore

Re: How can I specify multiple refs on one line in the config file?

On Wed, May 07, 2008 at 06:28:13PM -0400, Jeff King wrote:
Show 11 quoted lines
> >     [remote "origin"]
> >     	push = refs/heads/* refs/tags/*
> > 
> > That doesn't work, of course, but I imagine it is possible, and I just
> > can't figure out the syntax.
> 
> I imagine it is possible, too, but not with one line. How about:
> 
>   [remote "origin"]
>     push = refs/heads/*:refs/heads/*
>     push = refs/tags/*:refs/tags/*
Aside: configuring a remote as
  [remote "origin"]
    push = refs/heads/*
    push = refs/tags/*

seems to hang forever. I didn't expect it to _work_, but probably it should eventually terminate. ;)

-Peff
Jeff King· May 8, 2008, 03:32 UTC · re: Jeff King · lore

Re: How can I specify multiple refs on one line in the config file?

On Wed, May 07, 2008 at 06:29:47PM -0400, Jeff King wrote:
Show 8 quoted lines
> Aside: configuring a remote as
> 
>   [remote "origin"]
>     push = refs/heads/*
>     push = refs/tags/*
> 
> seems to hang forever. I didn't expect it to _work_, but probably it
> should eventually terminate. ;)

Nevermind, this _does_ work. But there seems to be a bug in next that I was triggering with my test case. I'll send a separate message about it.

-Peff

← back to recent threads