From 74f9991db54bc6a9ad0084a126c8d308a8408542 2014-04-09 23:03:16 From: Min RK Date: 2014-04-09 23:03:16 Subject: [PATCH] Merge pull request #5478 from cowlicks/git-hooks Add git-hooks install script. Update README.md --- diff --git a/git-hooks/README.md b/git-hooks/README.md index bbdf44d..f60e1ed 100644 --- a/git-hooks/README.md +++ b/git-hooks/README.md @@ -6,9 +6,4 @@ For now, we just have `post-checkout` and `post-merge`, both of which just update submodules, so make sure that you have a fully synced repo whenever you checkout or pull. -To use these hooks, you can symlink or copy them to your `.git/hooks` directory. -In `.git/hooks`, do: - - ln -s ../../git-hooks/post-checkout post-checkout - ln -s ../../git-hooks/post-merge post-merge - +To use these hooks, run `./install-hooks.sh`. diff --git a/git-hooks/install-hooks.sh b/git-hooks/install-hooks.sh new file mode 100755 index 0000000..60ea641 --- /dev/null +++ b/git-hooks/install-hooks.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +DOTGIT=`git rev-parse --git-dir` +TOPLEVEL=`git rev-parse --show-toplevel` +TO=${DOTGIT}/hooks +FROM=${TOPLEVEL}/git-hooks + +ln -s ${FROM}/post-checkout ${TO}/post-checkout +ln -s ${FROM}/post-merge ${TO}/post-merge