From da3a2568486af82b676f5f222c6529a73dbb7d67 Mon Sep 17 00:00:00 2001 From: Alexander Minges Date: Tue, 22 Jul 2025 10:48:34 +0200 Subject: [PATCH] feat: add git commit message template and setup - Create .gitmessage template with conventional commits format - Add .gitattributes for consistent line endings across platforms - Update CONTRIBUTING.md with template setup instructions - Update README.md development setup section - Template includes type reference, examples, and formatting guidance - Helps ensure consistent commit messages that pass gitlint validation The template guides contributors to write proper conventional commits and explains breaking change syntax, character limits, and best practices for consistent messaging. --- .gitattributes | 35 +++++++++++++++++++++++++++++++++++ .gitmessage | 40 ++++++++++++++++++++++++++++++++++++++++ CONTRIBUTING.md | 14 +++++++++++--- README.md | 14 ++++++++++---- 4 files changed, 96 insertions(+), 7 deletions(-) create mode 100644 .gitattributes create mode 100644 .gitmessage diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..c2ef5ab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,35 @@ +# Ensure consistent line endings across platforms +* text=auto + +# Force LF line endings for specific file types +*.py text eol=lf +*.yaml text eol=lf +*.yml text eol=lf +*.json text eol=lf +*.md text eol=lf +*.rst text eol=lf +*.txt text eol=lf +*.cfg text eol=lf +*.ini text eol=lf +*.toml text eol=lf + +# Git-specific files +.gitignore text eol=lf +.gitattributes text eol=lf +.gitmessage text eol=lf + +# Scripts should use LF +*.sh text eol=lf + +# Binary files +*.png binary +*.jpg binary +*.jpeg binary +*.gif binary +*.ico binary +*.pdf binary +*.zip binary +*.tar.gz binary + +# Documentation images +*.webp binary diff --git a/.gitmessage b/.gitmessage new file mode 100644 index 0000000..e3d4b1c --- /dev/null +++ b/.gitmessage @@ -0,0 +1,40 @@ +# [optional scope][optional !]: +# +# [optional body] +# +# [optional footer(s)] + +# --- COMMIT END --- +# Type can be: +# feat (new feature) +# fix (bug fix) +# docs (documentation) +# style (formatting, no code change) +# refactor (refactoring production code) +# test (adding tests, refactoring test; no production code change) +# chore (updating build process or auxiliary tools; no production code change) +# ci (changes to CI configuration files and scripts) +# build (changes that affect the build system or dependencies) +# perf (performance improvements) +# revert (reverting a previous commit) +# +# Scope is optional and should be a noun describing the section of codebase +# Examples: (api), (ui), (config), (tests), (docs) +# +# Use ! after type/scope to indicate breaking changes: feat!, fix(api)! +# +# Breaking change footer format: +# BREAKING CHANGE: description of the breaking change +# +# Remember: +# - Use imperative mood in the description ("add" not "added") +# - Don't end the description with a period +# - Keep first line under 50 characters +# - Wrap body at 72 characters +# - Separate body and footer with blank lines +# +# Examples: +# feat: add user authentication +# fix(api): handle null response from external service +# feat!: remove deprecated login endpoint +# docs: update installation instructions diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 771fc6b..43f0852 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,9 +14,17 @@ Thank you for your interest in contributing to **doi2dataset**! We welcome contr ```bash pip install -r requirements-dev.txt ``` -4. **Make** your changes -5. **Test** your changes (see [Testing](#testing) below) -6. **Submit** a pull request +4. **Set up** commit message template (recommended): + ```bash + git config commit.template .gitmessage + ``` +5. **Install** pre-commit hooks (recommended): + ```bash + pre-commit install --hook-type pre-commit --hook-type commit-msg + ``` +6. **Make** your changes +7. **Test** your changes (see [Testing](#testing) below) +8. **Submit** a pull request ## How to Contribute diff --git a/README.md b/README.md index 1dde2ce..0856cb5 100644 --- a/README.md +++ b/README.md @@ -403,19 +403,25 @@ Contributions are welcome! Please fork the repository and submit a pull request pip install -r requirements-dev.txt ``` -2. Install pre-commit hooks (recommended): +2. Set up commit message template (recommended): ```bash - pre-commit install --hook-type commit-msg + git config commit.template .gitmessage ``` -3. Run tests to ensure everything works: +3. Install pre-commit hooks (recommended): + + ```bash + pre-commit install --hook-type pre-commit --hook-type commit-msg + ``` + +4. Run tests to ensure everything works: ```bash pytest ``` -4. Optionally run pre-commit on all files to check formatting: +5. Optionally run pre-commit on all files to check formatting: ```bash pre-commit run --all-files