Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Workflow & Pre-Commit Automation

Automated Git workflow toolkit featuring multi-language pre-commit spellchecking (codespell for German & English), rapid terminal fix routines, and comprehensive repository publishing guidelines.


Table of Contents


Overview

Documentation and commit messages frequently suffer from typos and language-mixing errors. This repository provides an automated Git pre-commit hook that scans staged text files before they enter version control, combined with terminal workflows to resolve findings within seconds.


Architecture & How It Works

When running git commit, the hook executes the following pipeline:

┌────────────────────────┐
│      git commit        │
└───────────┬────────────┘
            │
            ▼
┌────────────────────────┐
│  Filter Staged Files   │ ──► Matches .md, .txt, .rst, .adoc
└───────────┬────────────┘
            │
            ▼
┌────────────────────────┐
│    Run codespell       │ ──► Loads dictionaries & ignore lists
└───────────┬────────────┘
            │
     ┌──────┴──────┐
     ▼             ▼
 [Clean / Valid] [Errors Found]
     │             │
     ▼             ▼
 Commit OK     Commit rejected (Exit 1)
  1. Selective Scanning: Only staged modifications in text files are processed.
  2. Safe Path Handling: File paths are parsed with null-byte termination (-z) to prevent whitespace issues.
  3. Layered Dictionaries & Exclusions:
    • Global German dictionary (optional): ~/.config/git/codespell_de.txt
    • Global ignore list: ~/.config/git/codespell_ignore
    • Project-local ignore list: .codespellignore or .codespell_ignore

Directory Structure

Path Description
hooks/pre-commit Executable Bash pre-commit hook script
deployment.sh Installation script for local or global hook deployment
requirements.txt Python dependencies (codespell)
WORKFLOW.md Terminal reference guide for rapid spellcheck fixes
docs/git-publishing.md Comprehensive public publishing guide (English: GitHub CLI, licenses, GDPR, .gitignore)
docs/git-publizierung.md Leitfaden für die Veröffentlichung von Repositories (Deutsch)
LICENSE MIT Open Source License terms
README.md Main repository documentation

Prerequisites & Installation

1. System Packages

Debian / Ubuntu / Linux Mint

sudo apt update
sudo apt install codespell

Arch Linux

sudo pacman -S codespell

# Optional: German dictionary package from AUR
yay -S --needed codespell-dictionaries-git

2. Python (Alternative via pip / pipx)

pip install -r requirements.txt
# or isolated via pipx:
# pipx install codespell

Deployment

Option A: Global for All Git Repositories (Recommended)

Configures the hook globally in ~/.config/git/hooks/:

bash deployment.sh global
git config --global core.hooksPath ~/.config/git/hooks

Option B: Local to Current Repository Only

Installs the hook inside .git/hooks/pre-commit:

bash deployment.sh local

Configuration & Ignore Lists

  • Global Ignore List: Add terms to ~/.config/git/codespell_ignore (one word per line).
  • Project-Specific Ignore List: Create a .codespellignore file in the root of your target repository.

Terminal Fix Workflows

Detailed instructions on rapid terminal fix strategies (interactive codespell -i 3 -w, sed, ripgrep, ignore management, and emergency bypass) can be found in WORKFLOW.md.


Repository Publishing Guidelines

Before publishing code publicly to GitHub or other git hosts, review our best practices covering:

  • Security & Privacy: Redacting PII (GDPR/DSGVO) and company secrets.
  • Clean .gitignore: Excluding build artifacts, OS files, and environment files.
  • Licensing & Architecture: Choosing appropriate open-source licenses.
  • GitHub CLI: Direct terminal deployment via gh repo create.

For the complete guide, see:

  • English Publishing Guide
  • Deutscher Leitfaden zur Veröffentlichung

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Automated Git workflow toolkit featuring multi-language pre-commit spellchecking (DE/EN) with codespell, fast terminal fix routines, and repository publishing guidelines.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages