# Merge commit before branch tip

4 messages from 2010-07-26 to 2010-07-26. Participants: Bradley Wagner, Jonathan Nieder, Eugene Sajine, Matthieu Moy.
Thread: https://gitlist.dev/t/24527

## Bradley Wagner, 2010-07-26 15:38

Subject: Merge commit before branch tip
Message-ID: <AANLkTikp5dHz97qp3pf+DE-wABNVYTGAQ+h30D9Fa04c@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTikp5dHz97qp3pf%2BDE-wABNVYTGAQ%2Bh30D9Fa04c%40mail.gmail.com

```
I realize this is not a best practice but is it possible to merge a
branch but at a point before the branch tip?

This came up recently for us. There are 9 new commits in our stable
branch that need to be merged back into "master". However, there is 1
commit (the branch tip) that we're not all that happy with and don't
want to merge into the "master".

Ideally, I'd like them to show up as a merge rather than a cherry-pick
basically as if I'd done the merge before that latest commit was made.

```

## Jonathan Nieder, 2010-07-26 16:06

Subject: Re: Merge commit before branch tip
Message-ID: <20100726160620.GA4399@burratino>
URL: https://gitlist.dev/e/20100726160620.GA4399%40burratino
In-Reply-To: <AANLkTikp5dHz97qp3pf+DE-wABNVYTGAQ+h30D9Fa04c@mail.gmail.com>

```
Hi Bradley,

Bradley Wagner wrote:

> I realize this is not a best practice but is it possible to merge a
> branch but at a point before the branch tip?

I do not even think it is not a best practice.  You can do

  $ git fetch --all
  $ git merge origin/master~1

and git will happily create a merge with message

  Merge remote branch 'origin/master' (early part)

(See the "SPECIFYING REVISIONS" section of git-rev-parse(1)
for more examples.)

Hope that helps,
Jonathan

```

## Eugene Sajine, 2010-07-26 16:08

Subject: Re: Merge commit before branch tip
Message-ID: <AANLkTi=dOpWKAg9vH6sR2Xdi1XitD6vOx6Pd8Nt3A2bJ@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTi%3DdOpWKAg9vH6sR2Xdi1XitD6vOx6Pd8Nt3A2bJ%40mail.gmail.com
In-Reply-To: <AANLkTikp5dHz97qp3pf+DE-wABNVYTGAQ+h30D9Fa04c@mail.gmail.com>

```
On Mon, Jul 26, 2010 at 11:38 AM, Bradley Wagner
<bradley.wagner@hannonhill.com> wrote:
> I realize this is not a best practice but is it possible to merge a
> branch but at a point before the branch tip?
>
> This came up recently for us. There are 9 new commits in our stable
> branch that need to be merged back into "master". However, there is 1
> commit (the branch tip) that we're not all that happy with and don't
> want to merge into the "master".
>
> Ideally, I'd like them to show up as a merge rather than a cherry-pick
> basically as if I'd done the merge before that latest commit was made.

Isn't the following giving you what you need?

$ git co master
$ git merge stable~1

?

Thanks,
Eugene

```

## Matthieu Moy, 2010-07-26 16:15

Subject: Re: Merge commit before branch tip
Message-ID: <vpqy6cyw77d.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqy6cyw77d.fsf%40bauges.imag.fr
In-Reply-To: <20100726160620.GA4399@burratino>

```
Jonathan Nieder <jrnieder@gmail.com> writes:

> Hi Bradley,
>
> Bradley Wagner wrote:
>
>> I realize this is not a best practice but is it possible to merge a
>> branch but at a point before the branch tip?
>
> I do not even think it is not a best practice.  You can do
>
>   $ git fetch --all
>   $ git merge origin/master~1

... or whatever commit identifier indeed:

   $ git merge 64fdc08da

is fine too, but you have to find out the 64fdc08da part (using git
log for example).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

```
