{"id":4169,"date":"2020-09-27T00:40:35","date_gmt":"2020-09-26T15:40:35","guid":{"rendered":"https:\/\/akamist.com\/blog\/?p=4169"},"modified":"2020-09-27T00:40:35","modified_gmt":"2020-09-26T15:40:35","slug":"git%e3%81%ae%e3%82%b3%e3%83%9f%e3%83%83%e3%83%88%e3%83%ad%e3%82%b0%e3%81%ab%e3%83%81%e3%82%b1%e3%83%83%e3%83%88no%e3%81%8c%e5%90%ab%e3%81%be%e3%82%8c%e3%81%a6%e3%81%84%e3%82%8b%e3%81%8b%e3%83%81","status":"publish","type":"post","link":"https:\/\/akamist.com\/blog\/archives\/4169","title":{"rendered":"git\u306e\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u306b\u30c1\u30b1\u30c3\u30c8No\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u304b\u30c1\u30a7\u30c3\u30af\u3059\u308b"},"content":{"rendered":"<p>git\u3067\u30c1\u30fc\u30e0\u958b\u767a\u3092\u884c\u3063\u3066\u3044\u308b\u3068\u304d\u3001\u30b3\u30e1\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u7279\u5b9a\u306e\u30eb\u30fc\u30eb\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>git\u3067\u306f\u30d5\u30c3\u30af\u51e6\u7406\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308a\u3001commit-msg\u30d5\u30c3\u30af\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u304c\u7279\u5b9a\u306e\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044\u306a\u3044\u3068\u304d\u306bcommit\u51e6\u7406\u3092\u884c\u3048\u306a\u3044\u3088\u3046\u306b\u30d6\u30ed\u30c3\u30af\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u672c\u8a18\u4e8b\u3067\u306fcommit-msg\u30d5\u30c3\u30af\u3092\u4f7f\u3063\u3066\u30c1\u30a7\u30c3\u30af\u3059\u308b\u51e6\u7406\u306e\u4f5c\u308a\u65b9\u3092\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u3001\u60f3\u5b9a\u3059\u308b\u30eb\u30fc\u30eb\u306f\u3001\"\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u306e\uff11\u884c\u76ee\u306eissue tracking\u30c4\u30fc\u30eb\u306e\u30c1\u30b1\u30c3\u30c8No\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u3053\u3068\"\u3068\u3057\u3001\u30c1\u30b1\u30c3\u30c8No\u306f\"HPB-9999\"\u306e\u5f62\u5f0f\u3068\u3057\u307e\u3059\u3002\u901a\u5e38\u306fbash\u306a\u3069\u306e\u30b7\u30a7\u30eb\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u30d5\u30c3\u30af\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u304c\u3001\u4eca\u56de\u306f\u3042\u3048\u3066PHP\u3067\u30d5\u30c3\u30af\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n<h2>\u30d5\u30c3\u30af\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/h2>\n<p>\u307e\u305a\u3001\u30d5\u30c3\u30af\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-bash\">touch .git\/hooks\/commit-msg\nchmod 755 .git\/hooks\/commit-msg \n<\/code><\/pre>\n<p>\u6b21\u306b\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u4e2d\u8eab\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-php\">#!\/usr\/bin\/env php\n&lt;?php\n\n$lines = explode(PHP_EOL, file_get_contents($argv[1]));\nif (!preg_match('\/^HPB-[0-9]* \/', $lines[0])) {\n        echo '\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u306e1\u884c\u76ee\u306b\u306f\u30c1\u30b1\u30c3\u30c8\u756a\u53f7(HPB-9999)\u3092\u542b\u3081\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059' . PHP_EOL;\n        exit(1);\n}\n<\/code><\/pre>\n<p>commit-msg\u30d5\u30c3\u30af\u3067\u306f\u3001\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u306e\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u5165\u3063\u3066\u3044\u308b\u30d5\u30a1\u30a4\u30eb\u540d\u304c$argv[1]\u3067\u6e21\u3055\u308c\u308b\u306e\u3067\u3001\u3053\u308c\u3092file_get_contents()\u3067\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002\u3055\u3089\u306b\u3001explode()\u3067\u6539\u884c\u6587\u5b57\u3067\u5206\u5272\u3057\u305f\u914d\u5217\u306b\u3057\u3001$lines\u5909\u6570\u306b\u4ee3\u5165\u3057\u307e\u3059\u3002<\/p>\n<p>$lines[0]\u304c\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u306e\uff11\u884c\u76ee\u306a\u306e\u3067\u3001\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u3063\u30661\u884c\u76ee\u306e\u5148\u982d\u306b\"HPB-9999 \"\u306e\u5f62\u5f0f\u3067\u30ed\u30b0\u304c\u66f8\u304b\u308c\u3066\u3044\u308b\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30c1\u30a7\u30c3\u30af\u306b\u5f15\u3063\u304b\u304b\u3063\u305f\u3089(=\u30ed\u30b0\u304c\u66f8\u304b\u308c\u3066\u3044\u306a\u304b\u3063\u305f\u3089)\u3001\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u8868\u793a\u3057\u3001exit()\u30671\u3092\u8fd4\u3057\u3066\u3044\u307e\u3059\u3002git\u306f\u3053\u306e\u30b3\u30de\u30f3\u30c9\u306e\u7d50\u679c\u304c0\u4ee5\u5916\u306e\u5024\u3092\u8fd4\u3057\u305f\u3068\u304d\u306b\u3001\u30b3\u30df\u30c3\u30c8\u51e6\u7406\u3092\u4e2d\u65ad\u3057\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3067\u6e96\u5099\u306f\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<h2>\u52d5\u4f5c\u5b9f\u884c\u3059\u308b<\/h2>\n<p>\u8aa4\u3063\u305f\u5f62\u5f0f\u3067\u30b3\u30df\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u66f8\u3044\u3066commit\u3059\u308b\u3068\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u3001\u30b3\u30df\u30c3\u30c8\u304c\u884c\u308f\u308c\u307e\u305b\u3093\u3002<\/p>\n<pre><code class=\"language-bash\">% git commit -m \"invalid comment\"\n\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u306e1\u884c\u76ee\u306b\u306f\u30c1\u30b1\u30c3\u30c8\u756a\u53f7(HPB-9999)\u3092\u542b\u3081\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\n<\/code><\/pre>\n<p>SoureTree\u3092\u4f7f\u3063\u3066\u3044\u308b\u5834\u5408\u3067\u3082\u3001\u30a8\u30e9\u30fc\u30e1\u30c3\u30bb\u30fc\u30b8\u306f\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/akamist.com\/blog\/wp-content\/uploads\/2020\/09\/4129.png\" alt=\"\" width=\"626\" height=\"218\" class=\"alignnone size-full wp-image-4170\" \/><\/p>\n<p>\u6b63\u3057\u3044\u5f62\u5f0f\u3067\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u3092\u66f8\u304f\u3068\u3001\u3082\u3061\u308d\u3093\u30b3\u30df\u30c3\u30c8\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-bash\">% git commit -m \"HPB-1234 piyo\"\n 1 file changed, 1 insertion(+)\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>git\u3067\u30c1\u30fc\u30e0\u958b\u767a\u3092\u884c\u3063\u3066\u3044\u308b\u3068\u304d\u3001\u30b3\u30e1\u30c3\u30c8\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u7279\u5b9a\u306e\u30eb\u30fc\u30eb\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002 git\u3067\u306f\u30d5\u30c3\u30af\u51e6\u7406\u3068\u3044\u3046\u3082\u306e\u304c\u3042\u308a\u3001commit-msg\u30d5\u30c3\u30af\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30b3\u30df\u30c3\u30c8\u30ed\u30b0\u304c\u7279\u5b9a\u306e\u6761\u4ef6\u3092\u6e80\u305f\u3057\u3066\u3044 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":745,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[162],"tags":[],"aioseo_notices":[],"jetpack_featured_media_url":"https:\/\/akamist.com\/blog\/wp-content\/uploads\/2017\/08\/icon_git.png","jetpack-related-posts":[{"id":4940,"url":"https:\/\/akamist.com\/blog\/archives\/4940","url_meta":{"origin":4169,"position":0},"title":"PHPStorm\u306eGit\u30b9\u30c6\u30fc\u30b8\u6a5f\u80fd\u3092\u5229\u7528\u3059\u308b","date":"2022\u5e741\u67081\u65e5","format":false,"excerpt":"## \u80cc\u666f PHPStorm\u3067\u306f\u4ee5\u524d\u306fIDE\u304b\u3089Git\u306e\u30b9\u30c6\u30fc\u30b8\u3092\u5229\u7528\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u304c\u3001PhpSt\u2026","rel":"","context":"PHPStorm","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2022\/01\/4940_3.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3550,"url":"https:\/\/akamist.com\/blog\/archives\/3550","url_meta":{"origin":4169,"position":1},"title":"docker build\u3067\u4f55\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u66f8\u304d\u63db\u3048\u3089\u308c\u305f\u304b\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b","date":"2019\u5e743\u67083\u65e5","format":false,"excerpt":"Docker\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u696d\u524d\u5f8c\u3067git commit\u3059\u308b\u3053\u3068\u3067\u5909\u66f4\u304c\u304b\u304b\u3063\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u8a18\u9332\u3057\u3001 bu\u2026","rel":"","context":"Docker","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1178,"url":"https:\/\/akamist.com\/blog\/archives\/1178","url_meta":{"origin":4169,"position":2},"title":"[gcp]\"git push --all google\"\u3067\u30a8\u30e9\u30fc'credential-gcloud.sh' is not a git command.\u304c\u51fa\u308b\u3068\u304d","date":"2017\u5e7411\u670822\u65e5","format":false,"excerpt":"gcp\u306eCloud Source Repositories(\u30de\u30cd\u30fc\u30b8\u30c9\u306egit\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u30ea\u30dd\u30b8\u30c8\u30ea\u2026","rel":"","context":"gcp","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/09\/icon_gcp.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2863,"url":"https:\/\/akamist.com\/blog\/archives\/2863","url_meta":{"origin":4169,"position":3},"title":"mac\u306bbrew\u3067git\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3089\u884c\u3046\u3079\u304d\u3053\u3068","date":"2018\u5e745\u670831\u65e5","format":false,"excerpt":"mac\u3067`brew install git`\u30b3\u30de\u30f3\u30c9\u3067git\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30b9\u3057\u305f\u5834\u5408\u3001.bash_pr\u2026","rel":"","context":"git","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/08\/icon_git.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3086,"url":"https:\/\/akamist.com\/blog\/archives\/3086","url_meta":{"origin":4169,"position":4},"title":"\u30ed\u30ea\u30dd\u30c3\u30d7\u3067pip\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f7f\u3046python\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b","date":"2018\u5e747\u670816\u65e5","format":false,"excerpt":"\u30ec\u30f3\u30bf\u30eb\u30b5\u30fc\u30d0\u306e\u30ed\u30ea\u30dd\u30c3\u30d7\u3067\u306f\u3001python2\u7cfb\u30013\u7cfb\u306e\u5b9f\u884c\u74b0\u5883\u304c\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001python\u306e\u30d7\u30ed\u2026","rel":"","context":"\u30af\u30e9\u30a6\u30c9","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2018\/07\/icon_lolipop.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":2789,"url":"https:\/\/akamist.com\/blog\/archives\/2789","url_meta":{"origin":4169,"position":5},"title":"[MySQL]mysql\u30b3\u30de\u30f3\u30c9\u4f7f\u7528\u6642\u3001\u660e\u793a\u7684\u306bmy.cnf\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3059\u308b","date":"2018\u5e745\u670826\u65e5","format":false,"excerpt":"MySQL\u3067\u306fmysql\u30b3\u30de\u30f3\u30c9\u3067DB\u306b\u63a5\u7d9a\u3059\u308b\u6642\u306b\u3001\u63a5\u7d9a\u5148DB\u306e\u60c5\u5831\u3092\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u306e\u30d1\u30e9\u30e1\u30fc\u30bf\u3067\u2026","rel":"","context":"MySQL","img":{"alt_text":"","src":"https:\/\/i0.wp.com\/akamist.com\/blog\/wp-content\/uploads\/2017\/10\/icon_mysql.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/4169"}],"collection":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/comments?post=4169"}],"version-history":[{"count":2,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/4169\/revisions"}],"predecessor-version":[{"id":4172,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/posts\/4169\/revisions\/4172"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/media\/745"}],"wp:attachment":[{"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/media?parent=4169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/categories?post=4169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/akamist.com\/blog\/wp-json\/wp\/v2\/tags?post=4169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}