• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31

via http://ozmm.org/posts/git_post_commit_for_profit.html

gitのrefspecがよくわからなくて、調べていたら出会った記事です。

.git/hooks/pre-commitをshellスクリプトで

   1  $ chmod 744 .git/hooks/pre-commit
   2  $ cat .git/hooks/pre-commit 
   3  #!/bin/sh
   4  rake test

こういうのもありました。
http://reinh.com/blog/2008/02/21/git-pre-commit-hook.html

   1  #!/bin/sh
   2  rake spec 2> /dev/null

.git/hooks/pre-commitをrubyで

   1  $ cat .git/hooks/pre-commit
   2  #!/usr/bin/env ruby
   3  if `whoami`.strip != 'deploy'
   4    puts "You need to be `deploy`!" 
   5    exit 1
   6  else
   7    exit 0
   8  end

その他のhooks

.git/hooksには下記のようなファイルがあるので、preもpostもできるようです。

   1  post-commit                        
   2  post-receive
   3  post-update                        
   4  pre-applypatch
   5  pre-commit                         
   6  pre-rebase

pre-push hookはないのか

と思ったら、こういうパッチを書いている方がいます。パッチほとんどやったことないので、今度やってみよう。

http://kerneltrap.org/mailarchive/git/2008/8/19/2996404

posted by Png satoko on Thu 30 Oct 2008 at 16:34

Comments:

or Preview
Social Bookmarks
  • Delicious
  • B_entry987
  • Clip_16_12_w
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ