How to execute a command right after a fetch or pull command in git?

前端 未结 2 883
夕颜
夕颜 2020-12-08 04:24

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 ord

2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-08 05:14

    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.

提交回复
热议问题