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

9 messages from 2008-05-07 to 2008-05-08. Participants: Steve Hoelzer, Thomas Adam, Miklos Vajna, Jeff King.
Thread: https://gitlist.dev/t/13421

## Steve Hoelzer, 2008-05-07 21:15

Subject: How can I specify multiple refs on one line in the config file?
Message-ID: <588192970805071415wb7b502ch2047ac5e4865c296@mail.gmail.com>
URL: https://gitlist.dev/e/588192970805071415wb7b502ch2047ac5e4865c296%40mail.gmail.com

```
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, 2008-05-07 21:33

Subject: Re: How can I specify multiple refs on one line in the config file?
Message-ID: <18071eea0805071433j5bde8868w305d9a80c00bd2bd@mail.gmail.com>
URL: https://gitlist.dev/e/18071eea0805071433j5bde8868w305d9a80c00bd2bd%40mail.gmail.com
In-Reply-To: <588192970805071415wb7b502ch2047ac5e4865c296@mail.gmail.com>

```
2008/5/7 Steve Hoelzer <shoelzer@gmail.com>:
> 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, 2008-05-07 22:19

Subject: Re: How can I specify multiple refs on one line in the config file?
Message-ID: <588192970805071519i76c23367ue497e37445fa7c74@mail.gmail.com>
URL: https://gitlist.dev/e/588192970805071519i76c23367ue497e37445fa7c74%40mail.gmail.com
In-Reply-To: <18071eea0805071433j5bde8868w305d9a80c00bd2bd@mail.gmail.com>

```
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, 2008-05-07 22:27

Subject: Re: How can I specify multiple refs on one line in the config file?
Message-ID: <20080507222751.GC23672@genesis.frugalware.org>
URL: https://gitlist.dev/e/20080507222751.GC23672%40genesis.frugalware.org
In-Reply-To: <588192970805071519i76c23367ue497e37445fa7c74@mail.gmail.com>

```
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.

```

## Jeff King, 2008-05-07 22:28

Subject: Re: How can I specify multiple refs on one line in the config file?
Message-ID: <20080507222813.GF5994@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20080507222813.GF5994%40sigill.intra.peff.net
In-Reply-To: <588192970805071415wb7b502ch2047ac5e4865c296@mail.gmail.com>

```
On Wed, May 07, 2008 at 04:15:47PM -0500, Steve Hoelzer wrote:

> 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, 2008-05-07 22:29

Subject: Re: How can I specify multiple refs on one line in the config file?
Message-ID: <20080507222947.GA6427@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20080507222947.GA6427%40sigill.intra.peff.net
In-Reply-To: <20080507222813.GF5994@sigill.intra.peff.net>

```
On Wed, May 07, 2008 at 06:28:13PM -0400, Jeff King wrote:

> >     [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

```

## Thomas Adam, 2008-05-07 22:38

Subject: Re: How can I specify multiple refs on one line in the config file?
Message-ID: <18071eea0805071538w1e898ebalf4166b08fe7cfac3@mail.gmail.com>
URL: https://gitlist.dev/e/18071eea0805071538w1e898ebalf4166b08fe7cfac3%40mail.gmail.com
In-Reply-To: <20080507222751.GC23672@genesis.frugalware.org>

```
2008/5/7 Miklos Vajna <vmiklos@frugalware.org>:
>
> 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, 2008-05-07 23:58

Subject: Re: How can I specify multiple refs on one line in the config file?
Message-ID: <588192970805071658v7a3efab7g5d1c36afc818985d@mail.gmail.com>
URL: https://gitlist.dev/e/588192970805071658v7a3efab7g5d1c36afc818985d%40mail.gmail.com
In-Reply-To: <18071eea0805071538w1e898ebalf4166b08fe7cfac3@mail.gmail.com>

```
On Wed, May 7, 2008 at 5:38 PM, Thomas Adam <thomas.adam22@gmail.com> wrote:
> 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, 2008-05-08 03:32

Subject: Re: How can I specify multiple refs on one line in the config file?
Message-ID: <20080508033245.GA10735@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20080508033245.GA10735%40sigill.intra.peff.net
In-Reply-To: <20080507222947.GA6427@sigill.intra.peff.net>

```
On Wed, May 07, 2008 at 06:29:47PM -0400, Jeff King wrote:

> 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

```
