/
git pre-commit
git pre-commit
https://git-scm.com/book/ko/v2/Git%EB%A7%9E%EC%B6%A4-Git-Hooks git hooks 에서 pre-commit 활용하기
# install pre-commit
$ pip install pre-commit
# sample-config
$ pre-commit sample-config > .pre-commit-config.yaml
$ cat .pre-commit-config.yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
# Install the git hook scripts
$ pre-commit install
# run pre-commit
$ pre-commit run --all-files
지원하는 pre-commit : https://pre-commit.com/hooks.html
check-added-large-files
- 거대한 파일이 커밋되는 것을 방지합니다.trailing-whitespace
- trims trailing whitespaceend-of-file-fixer
- 파일이 비어 있거나 newline으로 끝나는지 확인합니다.check-yaml
- 구문 분석 가능한 구문에 대해 yaml 파일을 확인합니다.
위 문서에서 automatically enabling pre-commit on repositories 내용을 보면 git clone 할 때 pre-commit install
명령을 실행하지 않아도 자동으로 설정이 되도록 하는 옵션도 있다.
--no-verify 옵션을 이용해서 일시적으로 훅을 실행하지 않도록 생략할 수도 있음.
$ git commit -m 'test 2' --no-verify
, multiple selections available,
Related content
Github Action 과 Terraform 사전 커밋 후크의 지속적인 통합
Github Action 과 Terraform 사전 커밋 후크의 지속적인 통합
More like this
github actions
github actions
More like this
Github Actions 으로 terraform 실행하기
Github Actions 으로 terraform 실행하기
More like this
doctoc 이용해 markdown 파일 목차 생성하기
doctoc 이용해 markdown 파일 목차 생성하기
More like this
github self-hosted runners
github self-hosted runners
More like this
Github User Guide
Github User Guide
More like this