SlideShare a Scribd company logo
Git Hooks 
The lion tamer 
Umut IŞIK
Agenda 
▪ The Case 
▪ The Problem 
▪ The Purpose 
▪ Git Hooks 
▪ Personal Experience 
▪ Discussion
1. The Case 
Life Of Developer 
▪ Code 
▪ Bug Fix 
▪ Refactor 
▪ Work with Multiple Developers 
▪ Merge 
▪ Deadline
1. The Case 
Poor Pi
1. The Case 
▪ Pi is the developer 
▪ Boat is the software development 
▪ Storm, ocean, sun, etc are the challanges 
▪ Survival is the requirement 
▪ Tiger is the habbits
2. The Problem 
What we do? 
▪ Implementation 
▪ New Feature 
▪ Bug Fix 
▪ Commit 
▪ ‘git commit –a’
We are what we repeatedly do. Excellence, then, is not an act, but 
a habit. 
Aristotle 
2. The Problem
2. The Problem 
Habbits 
▪ Implementation 
▪ Coding standards 
▪ Code Comments 
▪ Naming convention 
▪ Unused variable 
▪ Copy/Paste
2. The Problem 
Habbits 
▪ Commit 
▪ Tests 
▪ Team members 
▪ The number of files 
▪ Case / Story ID
2. The Problem 
Confession Time
2. The Problem 
▪ We are a little bit lazy.
2. The Problem 
The ego 
▪ The all code is crap, except mine, attitude.
2. The Problem 
A Second Miracle 
▪ The “I fix that in a second” catastrophe. 
▪ The “That will only take a second” misconception.
2. The Problem 
We do not 
▪ obey coding standards 
▪ check unused variables 
▪ write comments
2. The Problem 
We like 
▪ copy paste
2. The Problem 
We commit without checking 
▪ Unit Tests 
▪ team members
2. The Problem 
▪ Bad habbits will kill you soon…
3. The Purpose 
▪ Try to have good habbits
3. The Purpose 
▪ Setup better rules (good habbits ☺ ) 
▪ Fource yourself to obey the new rules
4. Git Hooks 
Fire custom scripts when certain actions occured 
▪ Client-Side 
▪ Server-Side
4. Git Hooks 
Installation 
▪ Nothing todo 
▪ .git/hooks folder 
▪ Shell scripts 
▪ Custom scripts with Phyton, Ruby, PHP or whatever .. 
▪ Not interactive ☹
4. Git Hooks 
Client-Side 
▪ Committing Workflow 
▪ E-mail Workflow 
▪ Other
4. Git Hooks 
▪ Committing Workflow 
▪ pre-commit 
▪ prepare-commit-msg 
▪ commit-msg 
▪ post-commit 
▪ Email Workflow 
▪ applypatch-msg 
▪ pre-applypatch 
▪ post-applypatch
4. Git Hooks 
▪ Other 
▪ pre-rebase 
▪ post-merge 
▪ post-checkout
4. Git Hooks 
▪ Server-side 
▪ pre-receive 
▪ post-recieve 
▪ update
4. Personal Experience 
Bad habbits 
▪ Unused variable 
▪ Copy-Paste 
▪ Unit Test 
▪ Commit comments
4. Personal Experience 
Check my code before commit 
▪ Use «pre-commit» hook 
▪ Fired before commit 
▪ Can stop commit process
4. Personal Experience 
«php -l» syntax check 
▪ Syntax errors 
▪ Unused variables
4. Personal Experience 
«phpcpd» tool 
▪ Copy/Paste Detector (CPD) for PHP code
4. Personal Experience 
PHPCodesniffer 
▪ PHP, JavaScript and CSS files 
▪ Detects violations of a defined set of coding standards
4. Personal Experience 
▪ «pre-commit» hook
4. Personal Experience 
Commit message 
▪ «prepare-commit-msg» hook 
▪ Fired before comment editor 
▪ You can change default message 
▪ «commit-msg» hook 
▪ Validate commit comment
4. Personal Experience 
Improvement 
▪ Check view files for XSS 
▪ Check test implementation for methods 
▪ Check log implementation 
▪ Check if test the test suite failed because of my commit 
▪ Validate Jira/Mingle case id
5. Discussion ☺

More Related Content

PDF
Building your first Gutenberg block
PDF
Demystifying Gutenberg Blocks - Understanding the first steps to becoming a G...
PDF
Create Custom Page Builders with Gutenberg and ACF Blocks
PDF
On the Move, Migrations Made Simple
PDF
10 things you need to know about leaving shared hosting
PPTX
Node.js Getting Started &amd Best Practices
PPTX
First Pull Request - Sergio Ocon - ManageIQ Design Summit 2016
PPTX
Building the AO tech blog
Building your first Gutenberg block
Demystifying Gutenberg Blocks - Understanding the first steps to becoming a G...
Create Custom Page Builders with Gutenberg and ACF Blocks
On the Move, Migrations Made Simple
10 things you need to know about leaving shared hosting
Node.js Getting Started &amd Best Practices
First Pull Request - Sergio Ocon - ManageIQ Design Summit 2016
Building the AO tech blog

What's hot (17)

PDF
The Web We Weave :: How Web Developers Think About Performance
PPTX
Hack Rio/OS
PDF
Introduction To ICT Security Audit OWASP Day Malaysia 2011
PPTX
What is Node.js
PDF
C4ainaction-Introduction to the Pyramid Web Framework
PPTX
CI/CD doesn’t necessarily mean Jenkins - Omer Hamerman - DevOpsDays Tel Aviv ...
PDF
javerosmx-2015-marzo-groovy-java8-comparison
PPT
PHPUnit Automated Unit Testing Framework
PDF
Softshake 2013 - Let's take this offline
PDF
Getting Started With WP REST API
PDF
Groovy and noteworthy
PDF
Buildr - build like you code
ODP
Hands on BDD Javascript
PDF
Aprende, contribuye, y surfea Cloud Native Java - GuateJUG 2021
PDF
Introduction to pre-commit
PDF
Why don't you Groovy?
PDF
Rubygem Dev And Workflow
The Web We Weave :: How Web Developers Think About Performance
Hack Rio/OS
Introduction To ICT Security Audit OWASP Day Malaysia 2011
What is Node.js
C4ainaction-Introduction to the Pyramid Web Framework
CI/CD doesn’t necessarily mean Jenkins - Omer Hamerman - DevOpsDays Tel Aviv ...
javerosmx-2015-marzo-groovy-java8-comparison
PHPUnit Automated Unit Testing Framework
Softshake 2013 - Let's take this offline
Getting Started With WP REST API
Groovy and noteworthy
Buildr - build like you code
Hands on BDD Javascript
Aprende, contribuye, y surfea Cloud Native Java - GuateJUG 2021
Introduction to pre-commit
Why don't you Groovy?
Rubygem Dev And Workflow
Ad

Viewers also liked (20)

PDF
TMS - Schedule of Presentations and Reports
PDF
Advanced Git
PDF
FLTK Summer Course - Part VIII - Eighth Impact
PDF
FLTK Summer Course - Part III - Third Impact
PPT
Introduction to Git Commands and Concepts
PDF
FLTK Summer Course - Part VII - Seventh Impact
PDF
FLTK Summer Course - Part II - Second Impact
PDF
FLTK Summer Course - Part II - Second Impact - Exercises
PDF
Code Refactoring - Live Coding Demo (JavaDay 2014)
PDF
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
PPT
Creating Custom Drupal Modules
PDF
"Git Hooked!" Using Git hooks to improve your software development process
PPTX
Manipulating file in Python
PDF
Blisstering drupal module development ppt v1.2
PDF
Using Git on the Command Line
ODP
Servicios web con Python
PDF
FLTK Summer Course - Part VI - Sixth Impact - Exercises
PDF
FLTK Summer Course - Part I - First Impact - Exercises
PDF
Python Fuse
PPT
13 Graph Classes
TMS - Schedule of Presentations and Reports
Advanced Git
FLTK Summer Course - Part VIII - Eighth Impact
FLTK Summer Course - Part III - Third Impact
Introduction to Git Commands and Concepts
FLTK Summer Course - Part VII - Seventh Impact
FLTK Summer Course - Part II - Second Impact
FLTK Summer Course - Part II - Second Impact - Exercises
Code Refactoring - Live Coding Demo (JavaDay 2014)
EuroPython 2013 - FAST, DOCUMENTED AND RELIABLE JSON BASED WEBSERVICES WITH P...
Creating Custom Drupal Modules
"Git Hooked!" Using Git hooks to improve your software development process
Manipulating file in Python
Blisstering drupal module development ppt v1.2
Using Git on the Command Line
Servicios web con Python
FLTK Summer Course - Part VI - Sixth Impact - Exercises
FLTK Summer Course - Part I - First Impact - Exercises
Python Fuse
13 Graph Classes
Ad

Similar to Git hooks For PHP Developers (20)

PDF
Writing a Ruby Gem for beginners
PDF
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
PPTX
Joomla! Pizza Bugs and Fun 2014 pre-event Seminar
PPTX
Better WordPress Theme Development Workflow
PDF
Open Source Tools for Leveling Up Operations FOSSET 2014
PDF
Five ways to be a happier JavaScript developer
PDF
Drupalhagen 2014 kiss omg ftw
PPTX
Refactoring Legacy Code - true story
PDF
Detecting secrets in code committed to gitlab (in real time)
PPTX
Front Page of Hacker News with GitLab Pages
PDF
OSS Security the hard way
PPTX
Putting the D&D in TDD
PPTX
NDC London 2020 - Challenges of Managing CoreFx Repo -- Karel Zikmund
PDF
Git Things Done
PPT
Debugging rails
PDF
It Sounded Good on Paper - Lessons Learned with Puppet
PDF
Packaging perl (LPW2010)
PDF
Mehes Artem CV
PPT
Git preso to valtech cfml team
PPTX
Que nos espera a los ALM Dudes para el 2013?
Writing a Ruby Gem for beginners
Aki Salmi - Refactoring legacy code: a true story @ I T.A.K.E. Unconference 2...
Joomla! Pizza Bugs and Fun 2014 pre-event Seminar
Better WordPress Theme Development Workflow
Open Source Tools for Leveling Up Operations FOSSET 2014
Five ways to be a happier JavaScript developer
Drupalhagen 2014 kiss omg ftw
Refactoring Legacy Code - true story
Detecting secrets in code committed to gitlab (in real time)
Front Page of Hacker News with GitLab Pages
OSS Security the hard way
Putting the D&D in TDD
NDC London 2020 - Challenges of Managing CoreFx Repo -- Karel Zikmund
Git Things Done
Debugging rails
It Sounded Good on Paper - Lessons Learned with Puppet
Packaging perl (LPW2010)
Mehes Artem CV
Git preso to valtech cfml team
Que nos espera a los ALM Dudes para el 2013?

More from Umut IŞIK (20)

PDF
Açık Kaynağa Nasıl Katkı Yapabiliriz?
PDF
Php projelerinde ci_uygulama
PDF
Açık Kaynağa Nasıl Katkı Yapabiliriz?
PDF
A Ci Experience
PDF
BBS Flyers 08/2016
PDF
BBS Flyers 07/2016
PDF
BBS Flyers 05/2016
PDF
BBS Flyers 03/2016
PDF
BBS Flyers 02/2016
PDF
BBS Flyers 01/2016
PDF
BBS Flyers 12/2015
PDF
BBS Flyers 11/2015
PDF
BBS Flyers 10/2015
PDF
BBS Flyers 09/2015
PPTX
Ionic
PDF
BBS Flyers 08/2015
PDF
BBS Flyers-07-2015
PDF
BBS Flyers 06/2015
PDF
BBS Flyers 05/2015
PDF
BBS Flyers 04/2015
Açık Kaynağa Nasıl Katkı Yapabiliriz?
Php projelerinde ci_uygulama
Açık Kaynağa Nasıl Katkı Yapabiliriz?
A Ci Experience
BBS Flyers 08/2016
BBS Flyers 07/2016
BBS Flyers 05/2016
BBS Flyers 03/2016
BBS Flyers 02/2016
BBS Flyers 01/2016
BBS Flyers 12/2015
BBS Flyers 11/2015
BBS Flyers 10/2015
BBS Flyers 09/2015
Ionic
BBS Flyers 08/2015
BBS Flyers-07-2015
BBS Flyers 06/2015
BBS Flyers 05/2015
BBS Flyers 04/2015

Recently uploaded (20)

PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
A Presentation on Artificial Intelligence
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Empathic Computing: Creating Shared Understanding
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
cuic standard and advanced reporting.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PPT
Teaching material agriculture food technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
KodekX | Application Modernization Development
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Diabetes mellitus diagnosis method based random forest with bat algorithm
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Big Data Technologies - Introduction.pptx
A Presentation on Artificial Intelligence
“AI and Expert System Decision Support & Business Intelligence Systems”
Dropbox Q2 2025 Financial Results & Investor Presentation
Empathic Computing: Creating Shared Understanding
Unlocking AI with Model Context Protocol (MCP)
Per capita expenditure prediction using model stacking based on satellite ima...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
cuic standard and advanced reporting.pdf
NewMind AI Monthly Chronicles - July 2025
Teaching material agriculture food technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Mobile App Security Testing_ A Comprehensive Guide.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
KodekX | Application Modernization Development
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...

Git hooks For PHP Developers

  • 1. Git Hooks The lion tamer Umut IŞIK
  • 2. Agenda ▪ The Case ▪ The Problem ▪ The Purpose ▪ Git Hooks ▪ Personal Experience ▪ Discussion
  • 3. 1. The Case Life Of Developer ▪ Code ▪ Bug Fix ▪ Refactor ▪ Work with Multiple Developers ▪ Merge ▪ Deadline
  • 4. 1. The Case Poor Pi
  • 5. 1. The Case ▪ Pi is the developer ▪ Boat is the software development ▪ Storm, ocean, sun, etc are the challanges ▪ Survival is the requirement ▪ Tiger is the habbits
  • 6. 2. The Problem What we do? ▪ Implementation ▪ New Feature ▪ Bug Fix ▪ Commit ▪ ‘git commit –a’
  • 7. We are what we repeatedly do. Excellence, then, is not an act, but a habit. Aristotle 2. The Problem
  • 8. 2. The Problem Habbits ▪ Implementation ▪ Coding standards ▪ Code Comments ▪ Naming convention ▪ Unused variable ▪ Copy/Paste
  • 9. 2. The Problem Habbits ▪ Commit ▪ Tests ▪ Team members ▪ The number of files ▪ Case / Story ID
  • 10. 2. The Problem Confession Time
  • 11. 2. The Problem ▪ We are a little bit lazy.
  • 12. 2. The Problem The ego ▪ The all code is crap, except mine, attitude.
  • 13. 2. The Problem A Second Miracle ▪ The “I fix that in a second” catastrophe. ▪ The “That will only take a second” misconception.
  • 14. 2. The Problem We do not ▪ obey coding standards ▪ check unused variables ▪ write comments
  • 15. 2. The Problem We like ▪ copy paste
  • 16. 2. The Problem We commit without checking ▪ Unit Tests ▪ team members
  • 17. 2. The Problem ▪ Bad habbits will kill you soon…
  • 18. 3. The Purpose ▪ Try to have good habbits
  • 19. 3. The Purpose ▪ Setup better rules (good habbits ☺ ) ▪ Fource yourself to obey the new rules
  • 20. 4. Git Hooks Fire custom scripts when certain actions occured ▪ Client-Side ▪ Server-Side
  • 21. 4. Git Hooks Installation ▪ Nothing todo ▪ .git/hooks folder ▪ Shell scripts ▪ Custom scripts with Phyton, Ruby, PHP or whatever .. ▪ Not interactive ☹
  • 22. 4. Git Hooks Client-Side ▪ Committing Workflow ▪ E-mail Workflow ▪ Other
  • 23. 4. Git Hooks ▪ Committing Workflow ▪ pre-commit ▪ prepare-commit-msg ▪ commit-msg ▪ post-commit ▪ Email Workflow ▪ applypatch-msg ▪ pre-applypatch ▪ post-applypatch
  • 24. 4. Git Hooks ▪ Other ▪ pre-rebase ▪ post-merge ▪ post-checkout
  • 25. 4. Git Hooks ▪ Server-side ▪ pre-receive ▪ post-recieve ▪ update
  • 26. 4. Personal Experience Bad habbits ▪ Unused variable ▪ Copy-Paste ▪ Unit Test ▪ Commit comments
  • 27. 4. Personal Experience Check my code before commit ▪ Use «pre-commit» hook ▪ Fired before commit ▪ Can stop commit process
  • 28. 4. Personal Experience «php -l» syntax check ▪ Syntax errors ▪ Unused variables
  • 29. 4. Personal Experience «phpcpd» tool ▪ Copy/Paste Detector (CPD) for PHP code
  • 30. 4. Personal Experience PHPCodesniffer ▪ PHP, JavaScript and CSS files ▪ Detects violations of a defined set of coding standards
  • 31. 4. Personal Experience ▪ «pre-commit» hook
  • 32. 4. Personal Experience Commit message ▪ «prepare-commit-msg» hook ▪ Fired before comment editor ▪ You can change default message ▪ «commit-msg» hook ▪ Validate commit comment
  • 33. 4. Personal Experience Improvement ▪ Check view files for XSS ▪ Check test implementation for methods ▪ Check log implementation ▪ Check if test the test suite failed because of my commit ▪ Validate Jira/Mingle case id