33

I cloned the GHC (Glasgow Haskell Compiler) repository. In order to build the compiler, you need several libraries, all of them are available as git repositories too. In order to ease ones live, the GHC hackers included a script sync-all that, when executed, updates all the dependent repositories.

Now to my question: How can I make git execute ./sync-all pull after I did a git pull automatically? I heard something about using hooks, but I don't really know, what I have to do.

4

2 に答える 2

30
于 2011-04-11T15:50:53.660 に答える
15

When you run git pull, git actually does a fetch followed by a merge. This means you can use the post-merge hook to execute a script when a pull is completed.

To set this up you just need to create an executable script in your repository's .git/hooks/ directory called post-merge.

Note that this script will not be run if the merge fails due to conflicts.

于 2014-01-24T16:57:24.170 に答える