# 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 [...]