Git#
Branches#
Git Branches are used to structure the developments and improvements.
Permanent Branches#
- production - includes the current stable (latest) version
- develop - includes all current developments
Temporary Branches#
- feature - includes the feature and improvements that will be implemented
- hotfix - includes small improvements before a release, should be branched from a release branch
- release - includes the current version to be released
The majority of the development will be done in feature
branches.
Gitignore#
This file specifies intentionally untracked files to ignore.
It is copied from a collection of .gitignore templates.
For more information about how 📝 .gitignore
files work, see the Ignoring Files chapter of the Pro Git book.
Issue Templates#
Issue Templates offer specific functions and default configurations for new issues.
Pull Request (PR) Template#
The Pull Request Template is used for all PR, because it is only possible to create a single one. It includes all needed information to merge branches and release new versions.
GitHub Labels#
GitHub Labels are used to organize Issues and PR.
Colours and emoticons improve presentation, see:
📝 github-labels.json
GitHub Workflows (Actions)#
GitHub Actions
are used to automate processes of the repository.
Main use-cases are building and publishing the documentation and run automated tests.
Pre-commit#
Pre-commit is a tool to easily setup and run pre-commit hooks
for your git repository.
See the best-practice documentation of pre-commit or the
official documentation for further information.
It is used to improve auto-format code, do linting and run tests before every commit.
Install#
Install the required package in a python environment.
💻 pip install pre-commit
Install pre-commit
💻 pre-commit install
Install pre-commit
Setup#
The hooks are configured in the file 📝 .pre-commit-config.yaml
.
List of implemented hooks:
- Pre-commit-hooks - Out-of-the-box hooks
- Black - Python code formatter
- isort - Sort Python imports
- Ruff - Fast Python linter, written in Rust
- Flake8 - Python linter with PyFlakes and pycodestyle
- mypy mirror - Added static types to Python
- mirrors-prettier - Formatting for other files then python scripts
- reuse - License and copyright information
Use#
All commits will trigger the hooks automatically.
💠 git commit file -m "Commit message #IssueNr"
Commit with message
Commit without running the hooks.
💠 git commit --no-verify file
Commit without hooks
Line endings
There can be problems with file line endings on Windows, CRLF
is used on Windows and LF
is used on Linux.
To run the hooks on all files in your repository use:
💻 pre-commit run --all-files
Run pre-commit hooks
Markdown files / Admonitions
If the hook is applied to markdown files that include special formatting,
(for example 📝 mkdocs.yml
), this can introduce incorrect changes.
This effects admonitions boxes for MkDocs.
Used Icons
🐙 GitHub | 💠 git | 📝 File | 💻 Command Line