# git hook

Published articles for git hook.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Using Git Pre-Commit Hooks

DevFeed: [Using Git Pre-Commit Hooks](<https://devfeed.tech/articles/using-git-pre-commit-hooks-10917.md>)

Original publisher: [Read original article](<https://blog.scottlowe.org/2025/10/20/using-git-pre-commit-hooks/>)

Author: Scott Lowe

Published: 2025-10-20T15:00:00Z

Content type: tutorial

Language: en

Sources: [Scott's Weblog](<https://devfeed.tech/sources/scott-s-weblog.md>)

Topics: [Git](<https://devfeed.tech/topics/git.md>), [Markdown](<https://devfeed.tech/topics/markdown.md>), [Bash](<https://devfeed.tech/topics/bash.md>), [Script](<https://devfeed.tech/topics/script.md>)

Tags: [aws](<https://devfeed.tech/tags/aws.md>), [bash](<https://devfeed.tech/tags/bash.md>), [cilium](<https://devfeed.tech/tags/cilium.md>), [cli](<https://devfeed.tech/tags/cli.md>), [cloud](<https://devfeed.tech/tags/cloud.md>), [cni](<https://devfeed.tech/tags/cni.md>), [code](<https://devfeed.tech/tags/code.md>), [containers](<https://devfeed.tech/tags/containers.md>), [cri-o](<https://devfeed.tech/tags/cri-o.md>), [devops](<https://devfeed.tech/tags/devops.md>), [docker](<https://devfeed.tech/tags/docker.md>), [git](<https://devfeed.tech/tags/git.md>), [git-commit](<https://devfeed.tech/tags/git-commit.md>), [git-hook](<https://devfeed.tech/tags/git-hook.md>), [go](<https://devfeed.tech/tags/go.md>), [hooks](<https://devfeed.tech/tags/hooks.md>), [iac](<https://devfeed.tech/tags/iac.md>), [k8s](<https://devfeed.tech/tags/k8s.md>), [kubernetes](<https://devfeed.tech/tags/kubernetes.md>), [lint](<https://devfeed.tech/tags/lint.md>), [linux](<https://devfeed.tech/tags/linux.md>), [markdown](<https://devfeed.tech/tags/markdown.md>), [networking](<https://devfeed.tech/tags/networking.md>), [oci](<https://devfeed.tech/tags/oci.md>), [script](<https://devfeed.tech/tags/script.md>), [security](<https://devfeed.tech/tags/security.md>), [tests](<https://devfeed.tech/tags/tests.md>)

### AI overview

This tutorial explains Git pre-commit hooks and demonstrates using one to run Markdownlint on staged Markdown files before a commit. It notes that a non-zero hook exit status aborts the commit and presents a Bash implementation based on the author's site.

### Source excerpt

A while ago I wrote an article about linting Markdown files with markdownlint. In that article, I presented the use case of linting the Markdown source files for this site. While manually running linting checks is fine--there are times and situations when this is appropriate and necessary--this is the sort of task that is ideally suited for a Git pre-commit hook. In this post, I'll discuss Git pre-commit hooks in the context of using them to run linting checks. Before moving on, a disclaimer: I am not an expert on Git hooks. This post shares my limited experience and provides an example based on what I use for this site. I have no doubt that my current implementation will improve over time as my knowledge and experience grow. What is a Git Hook? As this page explains, a hook is a program "you can place in a hooks directory to trigger actions at certain points in git's execution." Generally, a hook is a script of some sort. Git supports different hooks that get invoked in response to specific actions in Git; in this particular instance, I'm focusing on the pre-commit hook. This hook gets invoked by git-commit (i.e., the user running a git commit command) and allows users to perform a series of checks or tests before actually making a commit. If the pre-commit script exits with a non-zero status, then Git aborts the commit. Using a Pre-Commit Hook to Lint Markdown For my use case, I wanted to run Markdownlint to lint the Markdown files (as described in the previous article on linting Markdown) before the commit. To do that, I came up with the following script: #!/usr/bin/env bash MDLINT="/usr/local/bin/markdownlint" for file in $(git diff --cached --name-only --diff-filter=ACM | grep "\.md"); do if ! $MDLINT "$file"; then echo "Lint check failed on file '$file'." echo "Run markdownlint to identify the errors and try again." exit 1 fi done To make this script active as a pre-commit hook, you must name it pre-commit, you must place it into Git's hook directory (which defa

## A component-based approach to managing team responsibility in Badoo and Bumble

DevFeed: [A component-based approach to managing team responsibility in Badoo and Bumble](<https://devfeed.tech/articles/article-23641.md>)

Original publisher: [Read original article](<https://habr.com/ru/companies/badoo/articles/562000/>)

Author: Unclead (Badoo)

Published: 2021-06-09T15:08:15Z

Content type: article

Language: ru

Sources: [Badoo EN](<https://devfeed.tech/sources/badoo-en.md>), [Badoo RU](<https://devfeed.tech/sources/badoo-ru.md>)

Topics: [PHP](<https://devfeed.tech/topics/php.md>), [phpstorm](<https://devfeed.tech/topics/phpstorm.md>), [Git](<https://devfeed.tech/topics/git.md>)

Tags: [badoo](<https://devfeed.tech/tags/badoo.md>), [bus-factor](<https://devfeed.tech/tags/bus-factor.md>), [git-hook](<https://devfeed.tech/tags/git-hook.md>), [php](<https://devfeed.tech/tags/php.md>), [phpstorm](<https://devfeed.tech/tags/phpstorm.md>), [tag-622612a5798e](<https://devfeed.tech/tags/tag-622612a5798e.md>), [tag-a3f08f91b7c9](<https://devfeed.tech/tags/tag-a3f08f91b7c9.md>), [tag-b3a84f87fd83](<https://devfeed.tech/tags/tag-b3a84f87fd83.md>), [tag-c51cc4bf76e5](<https://devfeed.tech/tags/tag-c51cc4bf76e5.md>), [team](<https://devfeed.tech/tags/team.md>)

### AI overview

The article describes how Badoo and Bumble addressed the challenge of identifying teams and maintainers responsible for parts of a growing PHP codebase. It explains the limitations of DocBlock tags, PhpStorm templates, and a Git hook, and introduces a component-based approach intended to centralize responsibility information and let other systems consume updates automatically.

### Source excerpt

Меня зовут Евгений Тупиков, я ведущий PHP-разработчик в Badoo и Bumble. У нас в команде более 200 бэкенд-разработчиков, которые работают над сотнями модулей и отдельных сервисов в наших приложениях. Но поначалу всё было не так масштабно. В 2006 году это был один проект, над которым работала небольшая команда. Каждый разработчик хорошо понимал, как всё устроено: легко ориентировался в коде, знал, какие есть сервисы и как они взаимодействуют между собой. Однако по мере роста проекта всё больше времени занимал поиск "хранителей знаний" -- тех, кто отвечает за ту или иную функциональность и к кому можно обратиться с вопросом или предложением. В этой статье я расскажу, как мы решили проблему разделения зон ответственности и сделали процесс актуализации информации быстрым и удобным с помощью компонентного подхода. Читать далее

## Detect when node\_modules are out of sync

DevFeed: [Detect when node\_modules are out of sync](<https://devfeed.tech/articles/detect-when-node-modules-are-out-of-sync-21371.md>)

Original publisher: [Read original article](<https://juri.dev/blog/2020/09/detect-node_modules-out-of-sync/>)

Published: 2020-09-01T00:00:00Z

Content type: tutorial

Language: en

Sources: [Juri Strumpflohner](<https://devfeed.tech/sources/juri-strumpflohner.md>)

Topics: [Node.js](<https://devfeed.tech/topics/node-js.md>), [Git](<https://devfeed.tech/topics/git.md>), [Script](<https://devfeed.tech/topics/script.md>), [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>), [webstorm](<https://devfeed.tech/topics/webstorm.md>)

Tags: [git](<https://devfeed.tech/tags/git.md>), [git-hook](<https://devfeed.tech/tags/git-hook.md>), [hooks](<https://devfeed.tech/tags/hooks.md>), [node](<https://devfeed.tech/tags/node.md>), [node-js](<https://devfeed.tech/tags/node-js.md>), [tooling](<https://devfeed.tech/tags/tooling.md>), [vscode](<https://devfeed.tech/tags/vscode.md>), [webstorm](<https://devfeed.tech/tags/webstorm.md>)

### AI overview

A tutorial on detecting when node_modules are out of sync after switching Git branches or commits. It explains a Node.js script that checks changed files for package.json and describes installing the script as a Git checkout hook.

### Source excerpt

Lorem ipsum dolor sit amet

## Merge Git Authors

DevFeed: [Merge Git Authors](<https://devfeed.tech/articles/merge-git-authors-29362.md>)

Original publisher: [Read original article](<https://arturdryomov.dev/posts/merge-git-authors/>)

Author: Artur Dryomov

Published: 2019-03-19T00:00:00Z

Content type: tutorial

Language: en

Sources: [Artur Dryomov](<https://devfeed.tech/sources/artur-dryomov.md>)

Topics: [Git](<https://devfeed.tech/topics/git.md>), [git hook](<https://devfeed.tech/topics/git-hook.md>), [bitbucket](<https://devfeed.tech/topics/bitbucket.md>)

Tags: [bitbucket](<https://devfeed.tech/tags/bitbucket.md>), [consistency](<https://devfeed.tech/tags/consistency.md>), [email](<https://devfeed.tech/tags/email.md>), [git](<https://devfeed.tech/tags/git.md>), [git-hook](<https://devfeed.tech/tags/git-hook.md>), [github](<https://devfeed.tech/tags/github.md>), [merge](<https://devfeed.tech/tags/merge.md>)

### AI overview

This article explains how to identify and consolidate inconsistent Git author names and email addresses so repository history accurately reflects contributor identities. It discusses Git commands, display limitations, tool support, and preventive checks using Bitbucket plugins or pre-commit hooks.

### Source excerpt

Stats! Stats are awesome. You can collect them, you can analyze and visualize them, you can boil, grill and fry them... Wait, that's not food, right? git shortlog Let's say we have a Git repository. We want to count commits per author. There is a Git command for that! $ git shortlog --summary --numbered 2 Bender Rodriguez 2 Philip J. Fry 1 Bending Unit 22 1 Turanga Leela There are actually three authors but since names are non-consistent Git makes it look like there are four. It gets worse with emails.

## git pre-commit hook for code beautification

DevFeed: [git pre-commit hook for code beautification](<https://devfeed.tech/articles/git-pre-commit-hook-for-code-beautification-21702.md>)

Original publisher: [Read original article](<https://nativeguru.wordpress.com/2016/01/30/git-pre-commit-hook-for-code-beautification/>)

Author: Ramon

Published: 2016-01-30T20:22:19Z

Content type: tutorial

Language: en

Sources: [Ramon Fried](<https://devfeed.tech/sources/ramon-fried.md>)

Topics: [Git](<https://devfeed.tech/topics/git.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Script](<https://devfeed.tech/topics/script.md>), [Kernel](<https://devfeed.tech/topics/kernel.md>), [Command-line interface](<https://devfeed.tech/topics/cli.md>)

Tags: [artistic-style](<https://devfeed.tech/tags/artistic-style.md>), [astyle](<https://devfeed.tech/tags/astyle.md>), [code-beautification](<https://devfeed.tech/tags/code-beautification.md>), [coding-style](<https://devfeed.tech/tags/coding-style.md>), [command-line](<https://devfeed.tech/tags/command-line.md>), [git](<https://devfeed.tech/tags/git.md>), [git-commit](<https://devfeed.tech/tags/git-commit.md>), [git-hook](<https://devfeed.tech/tags/git-hook.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [improvements](<https://devfeed.tech/tags/improvements.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [linux](<https://devfeed.tech/tags/linux.md>), [linux-kernel](<https://devfeed.tech/tags/linux-kernel.md>), [script](<https://devfeed.tech/tags/script.md>), [uncategorized](<https://devfeed.tech/tags/uncategorized.md>), [workflow](<https://devfeed.tech/tags/workflow.md>)

### AI overview

A tutorial on using a Git pre-commit hook to automate code beautification. The hook runs astyle on files included in a commit, helping apply formatting rules such as spacing and indentation; the article also discusses Linux user-space and kernel coding styles and the checkpatch.pl script.

### Source excerpt

Hi. In this post I will share a git pre-commit hook I created for aiding with code beautification. In Linux, I work in two different coding styles: User space and Kernel. The Linux kernel has a very specific coding style and every commit to kernel must adhere to that style. The Linux kernel provides a [...]