Last active
August 29, 2015 14:09
-
-
Save kairyou/c9d2ff89b85dc8b9f0d0 to your computer and use it in GitHub Desktop.
git hooks for .git/hooks/post-merge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// echo exec("pwd")."\n"; | |
$id = exec("git log -1 --pretty=%h"); | |
$msg = exec("git log -1 --pretty=%s"); | |
$user = exec("git log -1 --pretty=%cn\(%ce\)"); #name+email | |
$time = exec("git log -1 --pretty=%ai"); | |
exec("git diff-tree -p --no-commit-id $id", $diff); | |
$url = exec("git config --get remote.origin.url"); | |
if(empty($url)) { | |
$url = exec("git config --get remote.origin.pushurl"); | |
} | |
echo "===> hooks:\n"; | |
echo "commit_id: $id; msg: $msg; user: $user; time: $time;\n"; | |
$diff = str_replace("\n\ No newline at end of file", '', join("\n", $diff)); | |
echo $url; | |
echo "$diff\n"; | |
// git log --pretty=%h:%s HEAD ^0a89957^ #从commit(0a89957)到最新的commit之间的log | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment