# Symbolic 'references' in Git?

7 messages from 2011-04-14 to 2011-04-15. Participants: Chris Patti, Wesley J. Landaker, Jeff King, Junio C Hamano, Michael J Gruber.
Thread: https://gitlist.dev/t/27100

## Chris Patti, 2011-04-14 20:30

Subject: Symbolic 'references' in Git?
Message-ID: <BANLkTinV8niLibzOQRVraYqwB0hKW1=r1w@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTinV8niLibzOQRVraYqwB0hKW1%3Dr1w%40mail.gmail.com

```
Folks;

We want a way to have our Bamboo configuration utilize a symbol to
refer to 'latest release' 'latest patch' etc. in Git, rather than
having to go in and change the actual branch name every time we ship a
release and create a new one.

We thought about using something like:

git symbolic-ref -m'new next-release branch build for Bamboo'
next-release release-3.15

However, this symbolic ref is only local to one repository, and we
want it to be global across all of Bamboo.

Rather than resorting to manually copying the symbolic ref file
around, from repo to repo, is there any way to make such a symbolic
'variable' global?

Thanks!
-Chris


-- 
Christopher Patti - Geek At Large | GTalk: cpatti@gmail.com | AIM:
chrisfeohpatti | P: (260) 54PATTI
"Technology challenges art, art inspires technology." - John Lasseter, Pixar

```

## Wesley J. Landaker, 2011-04-14 21:24

Subject: Re: Symbolic 'references' in Git?
Message-ID: <201104141524.15212.wjl@icecavern.net>
URL: https://gitlist.dev/e/201104141524.15212.wjl%40icecavern.net
In-Reply-To: <BANLkTinV8niLibzOQRVraYqwB0hKW1=r1w@mail.gmail.com>

```
On Thursday, April 14, 2011 14:30:59 Chris Patti wrote:
> We want a way to have our Bamboo configuration utilize a symbol to
> refer to 'latest release' 'latest patch' etc. in Git, rather than
> having to go in and change the actual branch name every time we ship a
> release and create a new one.
> 
> We thought about using something like:
> 
> git symbolic-ref -m'new next-release branch build for Bamboo'
> next-release release-3.15
> 
> However, this symbolic ref is only local to one repository, and we
> want it to be global across all of Bamboo.
> 
> Rather than resorting to manually copying the symbolic ref file
> around, from repo to repo, is there any way to make such a symbolic
> 'variable' global?

Why not just use a tag or a branch ?

git tag -F next-release release-3.15

  OR

git branch -D next-release
git branch next-release release-3.15

(I personally think branches are nicer for this since tags are "supposed" to 
be immutable.)

```

## Chris Patti, 2011-04-14 21:31

Subject: Re: Symbolic 'references' in Git?
Message-ID: <BANLkTik5tD5UOrDkpL8ahEgwFjT+suHACQ@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTik5tD5UOrDkpL8ahEgwFjT%2BsuHACQ%40mail.gmail.com
In-Reply-To: <201104141524.15212.wjl@icecavern.net>

```
On Thu, Apr 14, 2011 at 5:24 PM, Wesley J. Landaker <wjl@icecavern.net> wrote:
> On Thursday, April 14, 2011 14:30:59 Chris Patti wrote:
>> We want a way to have our Bamboo configuration utilize a symbol to
>> refer to 'latest release' 'latest patch' etc. in Git, rather than
>> having to go in and change the actual branch name every time we ship a
>> release and create a new one.
>>
>> We thought about using something like:
>>
>> git symbolic-ref -m'new next-release branch build for Bamboo'
>> next-release release-3.15
>>
>> However, this symbolic ref is only local to one repository, and we
>> want it to be global across all of Bamboo.
>>
>> Rather than resorting to manually copying the symbolic ref file
>> around, from repo to repo, is there any way to make such a symbolic
>> 'variable' global?
>
> Why not just use a tag or a branch ?
>
> git tag -F next-release release-3.15
>
>  OR
>
> git branch -D next-release
> git branch next-release release-3.15
>
> (I personally think branches are nicer for this since tags are "supposed" to
> be immutable.)
>


Won't either of those things create a 'next-release' that's frozen in
time where the release-3.15 branch is *right now*?

This is for a CI system (Bamboo) so we need next-release to act as if
we were using release-3.15 itself.

Thanks,
-Chris

-- 
Christopher Patti - Geek At Large | GTalk: cpatti@gmail.com | AIM:
chrisfeohpatti | P: (260) 54PATTI
"Technology challenges art, art inspires technology." - John Lasseter, Pixar

```

## Jeff King, 2011-04-14 22:20

Subject: Re: Symbolic 'references' in Git?
Message-ID: <20110414222020.GB19222@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110414222020.GB19222%40sigill.intra.peff.net
In-Reply-To: <BANLkTik5tD5UOrDkpL8ahEgwFjT+suHACQ@mail.gmail.com>

```
On Thu, Apr 14, 2011 at 05:31:13PM -0400, Chris Patti wrote:

> >> Rather than resorting to manually copying the symbolic ref file
> >> around, from repo to repo, is there any way to make such a symbolic
> >> 'variable' global?
> >
> > Why not just use a tag or a branch ?
> >
> > git tag -F next-release release-3.15
> >
> >  OR
> >
> > git branch -D next-release
> > git branch next-release release-3.15
> >
> > (I personally think branches are nicer for this since tags are "supposed" to
> > be immutable.)
> >
> 
> 
> Won't either of those things create a 'next-release' that's frozen in
> time where the release-3.15 branch is *right now*?
> 
> This is for a CI system (Bamboo) so we need next-release to act as if
> we were using release-3.15 itself.

Yeah, a regular ref won't work for that. A symbolic ref is definitely
what you want, but their contents are not shared via the git-protocol.
So no, they won't make it across clones, fetches, or pushes. We do some
ugly magic to make HEAD work.

-Peff

```

## Wesley J. Landaker, 2011-04-14 22:22

Subject: Re: Symbolic 'references' in Git?
Message-ID: <201104141622.39491.wjl@icecavern.net>
URL: https://gitlist.dev/e/201104141622.39491.wjl%40icecavern.net
In-Reply-To: <BANLkTik5tD5UOrDkpL8ahEgwFjT+suHACQ@mail.gmail.com>

```
On Thursday, April 14, 2011 15:31:13 Chris Patti wrote:
> On Thu, Apr 14, 2011 at 5:24 PM, Wesley J. Landaker <wjl@icecavern.net> 
wrote:
> > Why not just use a tag or a branch ?
> 
> Won't either of those things create a 'next-release' that's frozen in
> time where the release-3.15 branch is *right now*?
> 
> This is for a CI system (Bamboo) so we need next-release to act as if
> we were using release-3.15 itself.

Yes, you are right, but I was thinking about how I usually see it done and 
do it in my projects is that "next-release" is what you always are working 
on, and "release-3.15" would only be made when 3.15 is finalized.

It sounds like you are doing it the other way around, in which case I agree 
that being able to easily share symbolic-refs would be solve the problem -- 
but I don't know how to do that, other than, say, a hook script that 
everyone uses.

Maybe someone else will chime in with a better solution? =)

```

## Junio C Hamano, 2011-04-14 23:00

Subject: Re: Symbolic 'references' in Git?
Message-ID: <7vd3kofnf9.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vd3kofnf9.fsf%40alter.siamese.dyndns.org
In-Reply-To: <BANLkTik5tD5UOrDkpL8ahEgwFjT+suHACQ@mail.gmail.com>

```
Chris Patti <cpatti@gmail.com> writes:

>> git branch -D next-release
>> git branch next-release release-3.15
>>
>> (I personally think branches are nicer for this since tags are "supposed" to
>> be immutable.)
>
> Won't either of those things create a 'next-release' that's frozen in
> time where the release-3.15 branch is *right now*?

I suspect that most people go about this the other way around.  You keep
the next-release branch that goes forward, and your automated process
would follow that one.  When you really cut a release, you tag the tip of
next-release, i.e. "git tag v3.15 next-release", to give it a name.

```

## Michael J Gruber, 2011-04-15 08:27

Subject: Re: Symbolic 'references' in Git?
Message-ID: <4DA80162.1070703@drmicha.warpmail.net>
URL: https://gitlist.dev/e/4DA80162.1070703%40drmicha.warpmail.net
In-Reply-To: <BANLkTik5tD5UOrDkpL8ahEgwFjT+suHACQ@mail.gmail.com>

```
Chris Patti venit, vidit, dixit 14.04.2011 23:31:
> On Thu, Apr 14, 2011 at 5:24 PM, Wesley J. Landaker <wjl@icecavern.net> wrote:
>> On Thursday, April 14, 2011 14:30:59 Chris Patti wrote:
>>> We want a way to have our Bamboo configuration utilize a symbol to
>>> refer to 'latest release' 'latest patch' etc. in Git, rather than
>>> having to go in and change the actual branch name every time we ship a
>>> release and create a new one.
>>>
>>> We thought about using something like:
>>>
>>> git symbolic-ref -m'new next-release branch build for Bamboo'
>>> next-release release-3.15
>>>
>>> However, this symbolic ref is only local to one repository, and we
>>> want it to be global across all of Bamboo.
>>>
>>> Rather than resorting to manually copying the symbolic ref file
>>> around, from repo to repo, is there any way to make such a symbolic
>>> 'variable' global?
>>
>> Why not just use a tag or a branch ?
>>
>> git tag -F next-release release-3.15
>>
>>  OR
>>
>> git branch -D next-release
>> git branch next-release release-3.15
>>
>> (I personally think branches are nicer for this since tags are "supposed" to
>> be immutable.)
>>
> 
> 
> Won't either of those things create a 'next-release' that's frozen in
> time where the release-3.15 branch is *right now*?
> 
> This is for a CI system (Bamboo) so we need next-release to act as if
> we were using release-3.15 itself.

Maybe add a refspec

refs/heads/release-3.15:refs/heads/release

which ensures that you push that branch out under two names? When you
(integrator/release manager) switch to a different release branch you
just need to change your config (and probably push -f).

Michael

```
