Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from pathlib import Path
- import subprocess
- CURRENT_DIR = Path('.')
- projects = sorted([x for x in CURRENT_DIR.iterdir() if x.is_dir()])
- for project in projects:
- print('*' * 70)
- print(f'Checking project: {project}')
- print('*' * 70)
- git_dir = project / '.git'
- if not git_dir.exists():
- print('Not a git repo. Skipping...')
- continue
- hooks_dir = git_dir / 'hooks'
- hooks = [x for x in hooks_dir.iterdir() if x.is_file()]
- for hook in hooks:
- print(f'Removing hook: {hook.name}')
- hook.unlink()
- subprocess.run(['git', 'init'], cwd=project)
Add Comment
Please, Sign In to add comment