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

Re: help for a git newbie please

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 29, 2010, 18:58 UTC
Message-ID
<m3k4iscsq2.fsf@localhost.localdomain>
In-Reply-To
<20053D7ED46E664F8B9A4D5E5B31937407197534@MBX021-W4-CA-1.exch021.domain.local>
Marlene Cote <Marlene_Cote@affirmednetworks.com> writes:
Show 8 quoted lines
> I don't understand the docs when they talk about hooks.  I have
> tried making my .git/hooks samples executable and they don't have
> any suffix to remove, so they should just run.  However, every time
> I make a new clone, the changes I made to the hooks are gone.  Just
> the samples get put into the clone again.  How do I put a hook in
> place that every developer will get and execute?  If I should be
> using server side hooks, where exactly would those go?  Should I
> modify the hooks under my repositories directory?

First, for the future, could you please use more specific subject? "Help for a git newbie please" doesn't tell us _anything_ about what problem do you have with git on first glance.

Second, hooks are not versioned and not under version control. They are not transferred on clone either. There are reasons for that, including the safety (running code under control of other side), and the fact that hooks are usually configured to local needs, so they might not make sense for other people.

Now, if you either use some kind of networked filesystem, or you can configure it so each developers machine has the same install, you can make use of git templates mechanism. This is the way git includes sample hooks in newly created repositories (git init, git clone, or even IIRC "git init" on existing repository).

Those template files are by default (on Linux) installed in /usr/share/git-core/templates. So what you can do is to put hooks you want each developer to have (either as executable hook, or as hook sample) in /usr/share/git-core/templates/hooks/ directory (or its equivalent in your installation).

I hope that helps.
-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Marlene CoteNext: Jonathan Nieder
Message 2 of 4 in “help for a git newbie please”
  1. Marlene CoteDec 29, 2010
  2. Jakub NarebskiDec 29, 2010
  3. shared hooks (Re: help for a git newbie please)Jonathan Nieder, Dec 29, 2010
  4. Marlene CoteDec 29, 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.