문서 보기역링크PDF로 내보내기맨 위로 이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요. # pre-commit pre-commit stage 에 주의 해서 설치해야 한다. `pre-commit install` 을 실행하면 `.git/hooks/pre-commit`이 생성된다. `commit-msg`를 실행하고 싶다면, 해당 훅을 설치해야 한다. <code> pre-commit install --hook-type commit-msg </code> ## hook-type 가능한 [[hook-type]] 목록 <code> {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg,post-checkout,post-commit,post-merge,post-rewrite} </code> 기본은 [[pre-commit]]이다.((명령어와 같다.)) ## 생성된 pre-commit <code> #!/usr/bin/env bash # File generated by pre-commit: https://pre-commit.com # ID: 138fd403232d2ddd5efb44317e38bf03 # start templated INSTALL_PYTHON=/opt/homebrew/opt/python@3.9/bin/python3.9 ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=pre-commit) # end templated HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") if [ -x "$INSTALL_PYTHON" ]; then exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}" elif command -v pre-commit > /dev/null; then exec pre-commit "${ARGS[@]}" else echo '`pre-commit` not found. Did you forget to activate your virtualenv?' 1>&2 exit 1 fi </code> ## 생성된 commit-msg <code> #!/usr/bin/env bash # File generated by pre-commit: https://pre-commit.com # ID: 138fd403232d2ddd5efb44317e38bf03 # start templated INSTALL_PYTHON=/opt/homebrew/opt/python@3.9/bin/python3.9 ARGS=(hook-impl --config=.pre-commit-config.yaml --hook-type=commit-msg) # end templated HERE="$(cd "$(dirname "$0")" && pwd)" ARGS+=(--hook-dir "$HERE" -- "$@") if [ -x "$INSTALL_PYTHON" ]; then exec "$INSTALL_PYTHON" -mpre_commit "${ARGS[@]}" elif command -v pre-commit > /dev/null; then exec pre-commit "${ARGS[@]}" else echo '`pre-commit` not found. Did you forget to activate your virtualenv?' 1>&2 exit 1 fi </code> ## github auto reference ![](https://i.imgur.com/wK3sOAR.png) ## .pre-commit-config.yaml <code> # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks default_stages: [commit] repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.0.1 hooks: - id: trailing-whitespace - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files - repo: local hooks: - id: jira-ticket-number-commit-msg name: Appending jira ticket number to commit message entry: bash -c 'bb --classpath hook --main prepare_commit_msg' stages: [commit-msg] language: system - id: clj-kondo name: Checking files with clj-kondo entry: hook/clj-kondo.sh stages: [push] language: script </code> open/pre-commit.txt 마지막으로 수정됨: 2022/05/19 07:28저자 127.0.0.1