Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (as of version 0.1.0).

## [0.3.0] `2026-05-08`

### Changed
- Adjusted the gitcc command to run properly when the git commit is run from the host machine (no container found).
- Moved the example scripts into the scripts/examples directory.


## [0.2.0] `2026-05-07`

### Added
Expand Down
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@

---

- Download the files and place the scripts directory and the gitcc shell script within your repo.
- Download the git-commit-check directory and place it within your repo (e.g. `path/to/your/repo/bin/git-commit-check`)

- Run the following commands to copy the pre-commit hook script example and the config example files
and edit their values according to your project.

Let's assume you placed gitcc files under the bin directory of your repo:
```
cp hooks/pre-commit.example hooks/pre-commit
cp config.sh.example config.sh
cd path/to/your/repo
cp bin/git-commit-check/hooks/pre-commit.example bin/git-commit-check/hooks/pre-commit
cp bin/git-commit-check/config.sh.example bin/git-commit-check/config.sh
```
- Run the following command to instruct git to call `gitcc` before allowing the developer to create a new commit.

`git config core.hooksPath hooks`
```
git config core.hooksPath bin/git-commit-check/hooks`
```
8 changes: 4 additions & 4 deletions config.sh.example
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/sh
# [general]
PROJECT_PATH="path/to/project"
GITCC_PATH="path/to/gitcc" # relative to the project path
PROJECT_PATH="/path/to/project" # Absolute path to the project, e.g. /var/www/my-project
GITCC_PATH="path/to/gitcc" # Relative path to the project, e.g. "bin/git-commit-check"
GITCC_REPORTS_PATH="$GITCC_PATH/reports"
GITCC_SCRIPTS_PATH="$GITCC_PATH/scripts"

cd "$PROJECT_PATH" || exit

# [scripts]
# Include the ids of those scripts that should be executed.
# [script IDs] - Include the ids of those scripts that should be executed.
ENABLED="01,02,03,04,05"

# [about]
Expand Down
2 changes: 1 addition & 1 deletion gitcc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
# Git Commit Check (gitcc)
# Version: 0.2.0
# Version: 0.3.0
# Author: Angelos Theodorakopoulos <angtheod@gmail.com>

# Change to the directory of the script and source the required scripts.
Expand Down
17 changes: 7 additions & 10 deletions hooks/pre-commit.example
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
#!/bin/sh
# This is the script for the pre-commit git hook
# To instruct git to use this script run `git config core.hooksPath hooks`
# Script for the pre-commit git hook.
# To configure git to run this script before each commit, run `git config core.hooksPath hooks`

# [pre-commit]
PROJECT_PATH="/path/to/project" # Absolute path to the project, e.g. /var/www/my-project
GITCC_PATH="path/to/gitcc" # Relative path to the project, e.g. "bin/git-commit-check"
CONTAINER_ENGINE=$(which docker 2>/dev/null || which podman 2>/dev/null)
PROJECT_PATH="/path/to/project"
CONTAINER_NAME="container_name"
SHELL="/bin/sh"
COMMAND="vendor/bin/gitcc"
#DOCKER_COMPOSE_PATH="/path/to/docker-compose.yml"
#CONTAINER_SERVICE="container_service_name"
COMMAND="$PROJECT_PATH/$GITCC_PATH/gitcc"

if [ -z "$CONTAINER_ENGINE" ]; then
vendor/bin/gitcc
eval "$COMMAND"
else
$CONTAINER_ENGINE exec -tw "$PROJECT_PATH" "$CONTAINER_NAME" "$SHELL" -c "$COMMAND"
#Same but using Dockers compose plugin (if installed)
#cd "$DOCKER_COMPOSE_PATH" || exit 1
#docker compose exec -Tw "$PROJECT_PATH" "$CONTAINER_SERVICE" "$SHELL" -c "$COMMAND"
fi
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.