Skip to content

Pre‐Commit

Jay Singh edited this page Jan 4, 2025 · 1 revision

Installation


Here's the sequence to re-initialize pre-commit after removing .git:

# 1. Remove old git and hooks
rm -rf .git
rm -rf .pre-commit-config.yaml.bak

# 2. Uninstall pre-commit hooks (in case any are lingering)
pre-commit uninstall

# 3. Initialize new git repository
git init
git checkout -b develop

# 4. Re-install pre-commit hooks
pre-commit install
pre-commit install --hook-type commit-msg

# 5. Run pre-commit autoupdate to get latest versions
pre-commit autoupdate

# 6. Test pre-commits on all files
pre-commit run --all-files

If you get any errors during the pre-commit installation, you can try:

# Clean pre-commit cache
pre-commit clean
pre-commit gc

# Then reinstall
pre-commit install
pre-commit install --hook-type commit-msg

Clone this wiki locally