# Preventing merges from one branch into others

2 messages from 2013-02-07 to 2013-02-07. Participants: Tim Chase, Junio C Hamano.
Thread: https://gitlist.dev/t/32850

## Tim Chase, 2013-02-07 19:14

Subject: Preventing merges from one branch into others
Message-ID: <20130207131440.716c1022@bigbox.christie.dr>
URL: https://gitlist.dev/e/20130207131440.716c1022%40bigbox.christie.dr

```
[tried IRC to no avail]
I've been trying to find a way to prevent myself from merging a
client-specific branch back into my dev/master branches.  Is there an
easy/straightforward way to do this (perhaps via a hook)?  I didn't
see any sort of "pre-merge" hook script.  Visualized:

  A -> B -> C [dev]
   \
    -> Q -> R -> S [customer-specific]

and I want to ensure that changes Q/R/S never find their way back
into dev.

So I was hoping some sort of "hey, you're an idiot for trying to merge
$CUSTOMER_BRANCH back into dev/master" warning. :-)

-tkc

```

## Junio C Hamano, 2013-02-07 19:38

Subject: Re: Preventing merges from one branch into others
Message-ID: <7v8v6z7w38.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7v8v6z7w38.fsf%40alter.siamese.dyndns.org
In-Reply-To: <20130207131440.716c1022@bigbox.christie.dr>

```
Tim Chase <git@tim.thechases.com> writes:

> ...  I didn't
> see any sort of "pre-merge" hook script.

http://thread.gmane.org/gmane.comp.version-control.git/94111/focus=71069

I think yours is a canonical example of "I do not want to run
command X when these conditions hold", when "these conditions" can
be checked locally _before_ you decide to do X.

While it is theoretically possible to give X a pre-X hook in such a
case, we do not want it to be the first choice to avoid hook bloat.

```
