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

Re: Why there is no pre-checkout hook?

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 15, 2010, 22:46 UTC
Message-ID
<7vr5fraxbf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<20101015083022.GA8763@burratino>
Jonathan Nieder <jrnieder@gmail.com> writes:
Show 13 quoted lines
> Óscar Fuentes wrote:
>
>> [Subject: Why there is no pre-checkout hook?]
>
> Because you can use your script in place of "git checkout".
>
> Or: because no one's come up with a compelling use case for
> one.
>
> Or: because no one implemented it and demonstrated how to
> use it yet.
>
> Take your pick. :)

The first one is the most correct answer from historical standpoint for almost any command, as git was designed to be scripted, and if you need pre-frotz to always run before running frotz you should be doing that before running frotz yoruself. The same for post-frotz that would unconditionally run after you run frotz.

Google/Bing/Gmane Search for "five valid reasons for git hook" ;-)

Having said that, I think it may be a good time to start thinking about loosening the criteria, especially unconditional pre- and post- ones, around Porcelain commands. The "five valid reasons" criteria apply to plumbing where you have more control and freedom and we do not want to spend extra cycles even to check for non-existence of hooks.

Previous: Jonathan Nieder
Message 3 of 3 in “Why there is no pre-checkout hook?”
  1. Óscar FuentesOct 15, 2010
  2. Jonathan NiederOct 15, 2010
  3. Junio C HamanoOct 15, 2010

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.