git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Has anyone written a hook to block fast forward merges to a branch?

From
NKNeal Kreitzinger <nkreitzinger@gmail.com>
Date
Mar 21, 2012, 21:14 UTC
Message-ID
<4F6A44AD.4040600@gmail.com>
In-Reply-To
<20120321204333.GB15021@sigill.intra.peff.net>
On 3/21/2012 3:43 PM, Jeff King wrote:
Show 17 quoted lines
> On Wed, Mar 21, 2012 at 03:32:10PM -0500, Neal Kreitzinger wrote:
>
>> On 3/21/2012 1:22 PM, Chris Patti wrote:
>>> I know there are hooks out there to block various other kinds of
>>> change, but I was wondering if anyone had specifically ever
>>> written one to block fast forward merges.
>>>
>> Maybe git-merge --no-ff would also be helpful to "do what you
>> want".
>
> When I wrote my response, I assumed the intent was that people
> _should_ be using --no-ff, but that he wanted to enforce it via hook
> during a push to a central repository.
>
> Reading it again, I'm not sure whether that is the case or not. If
> not, the disregard my original response. :)
>

Would your script only work at "push time", or would it also work at "commit time"? I'm not sure at what point he thinks he wants to enforce it. I don't think git yet knows the info your script is asking for at "commit time" (ie, pre-commit hook and its brethren), and by the time it does know it's too late to block the commit locally. Maybe it does know that inof at the point one of those "commit time" hooks runs. I haven't tried it.

v/r, neal

Previous: Jeff KingNext: Jeff King
Message 5 of 6 in “Has anyone written a hook to block fast forward merges to a branch?”
  1. Chris PattiMar 21, 2012
  2. Jeff KingMar 21, 2012
  3. Neal KreitzingerMar 21, 2012
  4. Jeff KingMar 21, 2012
  5. Neal KreitzingerMar 21, 2012
  6. Jeff KingMar 21, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.