# fast forward a branch from another

7 messages from 2011-05-12 to 2011-05-12. Participants: Eric Frederich, Michael J Gruber, Junio C Hamano, Phil Hord.
Thread: https://gitlist.dev/t/27339

## Eric Frederich, 2011-05-12 14:40

Subject: fast forward a branch from another
Message-ID: <BANLkTi=PtkDp8PNdMNi3hTwHPjFg+Jtftw@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTi%3DPtkDp8PNdMNi3hTwHPjFg%2BJtftw%40mail.gmail.com

```
Often times I get into a situation where I have a "development" branch
that gets ahead of say a "stable" branch.
When I am ready to call the development branch stable this is what I do.

$ git checkout stable
$ git merge development
$ git checkout development

The problem here is that the act of going backwards (via checking out
stable) really messes up my IDE and or Text editors.
Is there any way to do this without switching branches, which modifies
my working directory, which messes up my IDE?

Thanks,
~Eric

```

## Michael J Gruber, 2011-05-12 15:31

Subject: Re: fast forward a branch from another
Message-ID: <4DCBFD55.9050005@fastmail.fm>
URL: https://gitlist.dev/e/4DCBFD55.9050005%40fastmail.fm
In-Reply-To: <BANLkTi=PtkDp8PNdMNi3hTwHPjFg+Jtftw@mail.gmail.com>

```
Eric Frederich venit, vidit, dixit 12.05.2011 16:40:
> Often times I get into a situation where I have a "development" branch
> that gets ahead of say a "stable" branch.
> When I am ready to call the development branch stable this is what I do.
> 
> $ git checkout stable
> $ git merge development
> $ git checkout development
> 
> The problem here is that the act of going backwards (via checking out
> stable) really messes up my IDE and or Text editors.
> Is there any way to do this without switching branches, which modifies
> my working directory, which messes up my IDE?

I assume this is a ff-situation, i.e. stable is fully contained in
developement? then you can reset branch stable like this:

test 0 -eq $(git rev-list  --count ^development stable) && git branch -f
stable development

(I thought you could git rev-list --quiet but I'm too dumb :|)

Michael

```

## Michael J Gruber, 2011-05-12 15:34

Subject: Re: fast forward a branch from another
Message-ID: <4DCBFDE9.9060700@drmicha.warpmail.net>
URL: https://gitlist.dev/e/4DCBFDE9.9060700%40drmicha.warpmail.net
In-Reply-To: <4DCBFD55.9050005@fastmail.fm>

```
Michael J Gruber venit, vidit, dixit 12.05.2011 17:31:
> Eric Frederich venit, vidit, dixit 12.05.2011 16:40:
>> Often times I get into a situation where I have a "development" branch
>> that gets ahead of say a "stable" branch.
>> When I am ready to call the development branch stable this is what I do.
>>
>> $ git checkout stable
>> $ git merge development
>> $ git checkout development
>>
>> The problem here is that the act of going backwards (via checking out
>> stable) really messes up my IDE and or Text editors.
>> Is there any way to do this without switching branches, which modifies
>> my working directory, which messes up my IDE?
> 
> I assume this is a ff-situation, i.e. stable is fully contained in
> developement? then you can reset branch stable like this:
> 
> test 0 -eq $(git rev-list  --count ^development stable) && git branch -f
> stable development
> 
> (I thought you could git rev-list --quiet but I'm too dumb :|)

In fact, am I even too dumb to set my from address today. Sorry! Have to
give "virtual identity" another try...

Michael

```

## Junio C Hamano, 2011-05-12 16:06

Subject: Re: fast forward a branch from another
Message-ID: <7vsjsjdhud.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vsjsjdhud.fsf%40alter.siamese.dyndns.org
In-Reply-To: <BANLkTi=PtkDp8PNdMNi3hTwHPjFg+Jtftw@mail.gmail.com>

```
Eric Frederich <eric.frederich@gmail.com> writes:

> Often times I get into a situation where I have a "development" branch
> that gets ahead of say a "stable" branch.
> When I am ready to call the development branch stable this is what I do.
>
> $ git checkout stable
> $ git merge development
> $ git checkout development

Instead of switching to "stable", while still on the development, you
could do

	$ git push . HEAD:stable

which would succeed only when you are purely ahead of stable (otherwise it
will fail as you are not forcing).

```

## Phil Hord, 2011-05-12 16:26

Subject: Re: fast forward a branch from another
Message-ID: <4DCC0A4F.7000800@cisco.com>
URL: https://gitlist.dev/e/4DCC0A4F.7000800%40cisco.com
In-Reply-To: <7vsjsjdhud.fsf@alter.siamese.dyndns.org>

```

On 05/12/2011 12:06 PM, Junio C Hamano wrote:
> [...]
> Instead of switching to "stable", while still on the development, you
> could do
>
> 	$ git push . HEAD:stable
>
> which would succeed only when you are purely ahead of stable (otherwise it
> will fail as you are not forcing).
>

Wow!  Another gem. I didn't realize you could use 'dot' to refer to the
same repo you're in.

I don't see this feature listed in the git push [REMOTES] section.  Is
it documented somewhere else?

Phil

```

## Junio C Hamano, 2011-05-12 16:49

Subject: Re: fast forward a branch from another
Message-ID: <7vfwojdfta.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vfwojdfta.fsf%40alter.siamese.dyndns.org
In-Reply-To: <4DCC0A4F.7000800@cisco.com>

```
Phil Hord <hordp@cisco.com> writes:

> I don't see this feature listed in the git push [REMOTES] section.  Is
> it documented somewhere else?

Both "git help push" and "git help pull" will tell you in the "Git URLs"
section that a local file path is a way to name a repository.  Therefore,
you can say "git ls-remote $(pwd)" to list the the refs from the current
repository. If you are in git.git directory, "git ls-remote ../git.git"
does the same thing, so does "git ls-remote .".

These are merely specializations of more general "git push $path $refspec"
and nothing noteworthy.

```

## Phil Hord, 2011-05-12 16:58

Subject: Re: fast forward a branch from another
Message-ID: <4DCC11B8.8000805@cisco.com>
URL: https://gitlist.dev/e/4DCC11B8.8000805%40cisco.com
In-Reply-To: <7vfwojdfta.fsf@alter.siamese.dyndns.org>

```

On 05/12/2011 12:49 PM, Junio C Hamano wrote:
> Phil Hord <hordp@cisco.com> writes:
>
>> I don't see this feature listed in the git push [REMOTES] section.  Is
>> it documented somewhere else?
> Both "git help push" and "git help pull" will tell you in the "Git URLs"
> section that a local file path is a way to name a repository.  Therefore,
> you can say "git ls-remote $(pwd)" to list the the refs from the current
> repository. If you are in git.git directory, "git ls-remote ../git.git"
> does the same thing, so does "git ls-remote .".
>
> These are merely specializations of more general "git push $path $refspec"
> and nothing noteworthy.

Thanks for pointing out the obvious to me.  I guess I was thinking of it
as a parallel to '-', as in 'git checkout -', and simultaneously
distracted by the surprise realization that one can push from/to the
self-same repository.

Phil

```
