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

RFC: post-fetch hook

From
Joey Hess <joey@kitenet.net>
Date
Nov 12, 2011, 19:44 UTC
Message-ID
<20111112194414.GA3439@gnu.kitenet.net>

A post-fetch hook would run on the local repository after a git-fetch or git-pull. It would probably make sense for the hook to be sent the same format input as the post-receive hook (although I don't need that information myself). Like post-receive, it would not affect the outcome of the fetch. It should be called late enough that it can manipulate the git repository using the fetched refs.

My use case is in git-annex. It maintains its own, rather notes-like branch. When remote versions of the branch have changed, they are automatically merged into the local branch, using a union merge, the next time git-annex is run. So normally it does not need this hook.

But, consider the case where git-annex has locally modified its branch, and the remote tracking branch has also been modified. Now the user does "git pull; git push". With the two git-annex branches diverged the push fails. The user has to manually run "git annex merge" before pushing to handle this.

If there was a post-fetch hook, git-annex could make it always run git annex merge, and users would not need to deal with this situation.

-- 
see shy jo
Message 1 of 1 in “RFC: post-fetch hook”
  1. Joey HessNov 12, 2011

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.