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

Re: Post-receive hook for "git pull"

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 7, 2015, 19:54 UTC
Message-ID
<xmqqio4am3uk.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<jwv4mful6nu.fsf-monnier+gmane.comp.version-control.git@gnu.org>
Stefan Monnier <monnier@iro.umontreal.ca> writes:
Show 10 quoted lines
> I have a system here where it can be quite common to have thousands of
> branches in the remote repository, and where I'd like to update some
> local state according to the appearance of new branches (or updates of
> pre-existing ones).
>
> Currently, I use a "git for-each-ref" after pulling and then check (for
> each one of those refs) if an update is warranted, but this can get slow
> with that many branches.  Is there some way to get something like the
> post-receive hook to be run for "git pull", so that the script gets told
> directly which (remote tracking) branches have been modified/created?

I do not think there is. But you could easily script along the lines of...

    #!/bin/sh
    git for-each-ref | sort >prestate
    git pull "$@"
    git for-each-ref | sort >poststate
    comm -12 prestate poststate
... or something like that, no?
Previous: Stefan MonnierNext: Stefan Monnier
Message 2 of 3 in “Post-receive hook for "git pull"”
  1. Stefan MonnierDec 7, 2015
  2. Junio C HamanoDec 7, 2015
  3. Stefan MonnierFeb 12, 2016

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.