{"id":27845,"date":"2017-08-14T09:53:13","date_gmt":"2017-08-14T07:53:13","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=27845"},"modified":"2017-08-14T09:53:13","modified_gmt":"2017-08-14T07:53:13","slug":"pre-commit-a-framework-for-managingmulti-language-git-pre-commit-hooks","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2017\/08\/14\/pre-commit-a-framework-for-managingmulti-language-git-pre-commit-hooks\/","title":{"rendered":"pre-commit &#8211; a framework for managingmulti-language git pre-commit hooks"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p>From the <a href=\"http:\/\/pre-commit.com\/\">pre-commit homepage<\/a>:<\/p>\n<blockquote><p>Git hook scripts are useful for identifying simple issues before submission to code review. We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing whitespace, and debug statements. By pointing these issues out before code review, this allows a code reviewer to focus on the architecture of a change while not wasting time with trivial style nitpicks.<\/p>\n<p>As we created more libraries and projects we recognized that sharing our pre-commit hooks across projects is painful. We copied and pasted unwieldy bash scripts from project to project and had to manually change the hooks to work for different project structures.<\/p>\n<p>[&#8230;]<\/p>\n<p>We built pre-commit to solve our hook issues. It is a multi-language package manager for pre-commit hooks. You specify a list of hooks you want and pre-commit manages the installation and execution of any hook written in any language before every commit. pre-commit is specifically designed to not require root access.<\/p><\/blockquote>\n<p>Have a look at the list of <a href=\"http:\/\/pre-commit.com\/hooks.html\">all supported hooks<\/a>. There&#8217;s plenty!<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>From the pre-commit homepage: Git hook scripts are useful for identifying simple issues before submission to code review. We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing whitespace, and debug statements. By pointing these issues out before code review, this allows a code reviewer to &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2017\/08\/14\/pre-commit-a-framework-for-managingmulti-language-git-pre-commit-hooks\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">pre-commit &#8211; a framework for managingmulti-language git pre-commit hooks<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"pre-commit - a framework for managingmulti-language git pre-commit hooks #WebDev #git #PHP #VersionControl #QA","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1,18,62,1334],"tags":[3069,2265,38,1588,1330],"keyring_services":[],"class_list":["post-27845","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","category-technology","category-web-work","tag-best-practices","tag-git","tag-php","tag-version-control","tag-web-development"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":26154,"url":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/","url_meta":{"origin":27845,"position":0},"title":"Deploying with git","author":"Leonid Mamchenkov","date":"June 3, 2016","format":false,"excerpt":"Git is an excellent version control, but it's more than just that. \u00a0A lot of people use it to deploy their projects as well. \u00a0Most suggestions (for example, this tutorial from Digital\u00a0Ocean) around the web employ the post-commit (or other) hooks to push the code to a remote server. \u00a0While\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27671,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/06\/08\/git-commit-good-practice\/","url_meta":{"origin":27845,"position":1},"title":"Git Commit Good Practice","author":"Leonid Mamchenkov","date":"June 8, 2017","format":false,"excerpt":"Open Stack wiki has an excellent guide on how to create good commits. \u00a0In a few places it is too specific to Open Stack development practices, but overall it's one of the best guides I've seen for any project using git. It is basically split into two sections. \u00a0One on\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2017\/06\/git_commit.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":29204,"url":"https:\/\/mamchenkov.net\/wordpress\/2019\/01\/09\/grumphp-php-quality-control-tool\/","url_meta":{"origin":27845,"position":2},"title":"GrumPHP &#8211; PHP quality control tool","author":"Leonid Mamchenkov","date":"January 9, 2019","format":false,"excerpt":"GrumPHP is yet another quality control tool for PHP. But unlike a million other - PHPUnit, PHP CodeSniffer, and the like - this one is more of a tying knot. GrumPHP integrates via git hooks. It runs one more of the other tools, making sure that the changes you are\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2019\/01\/grumphp-grumpy.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":27374,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/02\/27\/moving-files-with-commit-history-from-one-git-repository-to-another\/","url_meta":{"origin":27845,"position":3},"title":"Moving files with commit history from one git repository to another","author":"Leonid Mamchenkov","date":"February 27, 2017","format":false,"excerpt":"I've searched for this before, and I'm sure I'll do that again (although the need is not that frequent), so here it goes. \u00a0It is possible to move files from one git repository to another, preserving commit history. \u00a0The following links provide a few examples of how to do this:\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":27460,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/03\/26\/composer-git-hooks-manage-git-hooks-in-your-composer-config\/","url_meta":{"origin":27845,"position":4},"title":"composer-git-hooks &#8211; manage git hooks in your composer config","author":"Leonid Mamchenkov","date":"March 26, 2017","format":false,"excerpt":"composer-git-hooks looks awesome! \u00a0From the project page description: Manage git hooks easily in your composer configuration. This package makes it easy to implement a consistent project-wide usage of git hooks. Specifying hooks in the composer file makes them available for every member of the project team. This provides a consistent\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":23822,"url":"https:\/\/mamchenkov.net\/wordpress\/2015\/04\/07\/10-years-of-git-an-interview-with-git-creator-linus-torvalds\/","url_meta":{"origin":27845,"position":5},"title":"10 Years of Git: An Interview with Git Creator Linus Torvalds","author":"Leonid Mamchenkov","date":"April 7, 2015","format":false,"excerpt":"Linux.com reminds us that git is celebrating its 10th birthday this year. \u00a0An interview with git creator Linus Torvalds sheds some light on to how and why it happened, and how long it took. You can actually see how it all took shape in the git source code repository, except\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"AtlassianGit10year","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2015\/04\/AtlassianGit10year-500x295.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/27845","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=27845"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/27845\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=27845"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=27845"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=27845"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=27845"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}