Interactive Git release cleanup and checkout utility.
Project description
🧹 Release Clean — Deterministic Git cleanup and release checkout
Release Clean is a deterministic Git utility designed to clean, reset, and position your local repository into a trusted release state before working on a specific release branch.
Its goal is simple and critical:
Ensure that your local environment is clean, consistent, and aligned with the correct release version, eliminating any hidden state that could compromise reliability.
🎯 Purpose
Release Clean was created to solve a common and dangerous problem in release workflows:
How can we guarantee that a developer’s local environment is not polluted before switching to a release branch?
Typical risks include:
- Residual build artifacts
- Ignored files affecting runtime behavior
- Untracked inconsistencies between developers
- Dirty working trees
- Outdated local branches
The solution is not manual cleanup — it is deterministic cleanup based on the repository state.
✨ Key Features
-
🧹 Cleanup based on
.gitignore:- uses
git clean -fdX
- uses
-
🧩 Preserves
node_modules/to improve developer experience -
🔄 Reset of tracked changes:
git checkout -- .
-
🌿 Safe synchronization of
main -
🚀 Deterministic checkout of
release/<VERSION> -
🔁 Pull of remote release branch
-
🔍 Validation of:
- Git repository context
- Version format
-
⚠️ Explicit confirmation (
y/N) before destructive actions -
🛑 Immediate stop on first failure
-
📋 Full execution trace (audit-friendly)
-
🎨 Highlighted execution steps (bold magenta)
-
🧩 Zero external dependencies (pure Python)
🧠 Operational Philosophy
Release Clean follows a strict principle:
The only reliable environment is a deterministic environment.
Instead of relying on manual cleanup or assumptions, the tool ensures that:
- Cleanup is aligned with
.gitignore - The working tree is fully reset
- The correct branch is used
- No hidden state leaks into the release
This ensures consistency across machines, teams, and environments.
⚙️ Executed Workflow
Release Clean executes the following sequence:
git clean -fdX -e node_modules/
git checkout -- .
git checkout main
git pull
git fetch --all
git checkout release/<VERSION>
git checkout -- .
git pull origin release/<VERSION>
🔍 Workflow Breakdown
1. Clean ignored files
git clean -fdX -e node_modules/
- Removes all files listed in
.gitignore - Preserves
node_modules/to avoid unnecessary reinstalls
2. Reset tracked changes
git checkout -- .
- Discards all tracked local changes
3. Synchronize base branch
git checkout main
git pull
git fetch --all
- Ensures
mainis up to date
4. Switch to release branch
git checkout release/<VERSION>
5. Enforce clean state on release
git checkout -- .
- Guarantees no local state leaks into the release branch
6. Update release branch
git pull origin release/<VERSION>
🚀 Installation
Requirements
- Python 3.9+
- Git installed and available in PATH
🍎 macOS Installation (recommended)
1️⃣ Install pipx
python3 -m pip install --user pipx
python3 -m pipx ensurepath
⚠️ Restart your terminal after installation.
2️⃣ Navigate to project directory
cd release-clean
3️⃣ Install globally
pipx install .
Now the command is available globally:
release-clean
▶️ Quick Test
release-clean
If the interactive prompt appears, installation is successful ✅
🔍 Optional Checks
which release-clean
pipx list
🧹 Updating
pipx reinstall release-clean
❌ Uninstall
pipx uninstall release-clean
⚠️ Important Notes
- Do not use
sudo pip install - Do not install CLI tools with system Python
- Always prefer
pipxfor CLI isolation
🧠 Rule of Thumb
Python library →
pip installPython CLI tool →pipx install
🧾 Usage
Run inside a Git repository:
release-clean
🔄 Execution Flow
- Prompt for version
- Validate version format
- Validate Git repository
- Display execution plan
- Request confirmation (
y/N) - Execute workflow
- Stop on first failure
- Print final summary
📌 Version Format
Accepted formats:
1.0.02.100.12.100.1-hotfix3.4.5-rc1
Invalid examples:
1.0release/1.0.0- empty values
⚠️ Important Behavior
🔥 Cleanup behavior
git clean -fdX -e node_modules/
This means:
| Type of file | Behavior |
|---|---|
.gitignore files |
❌ removed |
| tracked files | ❌ reset |
node_modules/ |
✅ preserved |
⚠️ Destructive actions
The tool will:
- remove ignored files
- discard tracked changes
- change branches
Execution only proceeds with explicit confirmation:
Continue? [y/N]
📊 Execution Summary
At the end, Release Clean prints:
- 🕒 Start and end time
- 📁 Repository path
- 🌿 Version and branch
- ✅ Successful actions
- ❌ Failed actions
- 📋 Full command list in execution order
🛡️ Ideal Use Cases
- Preparing local environment before a release
- Eliminating “works on my machine” issues
- Teams using
release/<version>strategy - Multi-developer environments
- Regulated or mission-critical systems
🔮 Future Enhancements
-
--dry-runmode (preview cleanup) -
--version(non-interactive execution) -
--no-color -
--ci(auto-confirm) -
Configurable exclusions (
--exclude node_modules) -
Summary export (
.md,.txt) -
Integration with:
- Slack
- Discord
- Jira
📜 License
MIT License.
👤 Author
André Argôlo CTO • Software Architect • DevOps
- 🌐 Website: https://argolo.dev
- 🐙 GitHub: https://github.com/argolo
🧭 About
Release Clean embodies a key engineering principle:
A clean environment is not optional — it is a prerequisite for reliability.
In modern development, subtle local inconsistencies can lead to:
- hidden bugs
- inconsistent builds
- unreliable validations
Release Clean eliminates that risk by enforcing:
- deterministic cleanup
- explicit control
- reproducible state
It is a minimal tool with a strong purpose:
protect the integrity of your release process.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file release_clean-1.0.3.tar.gz.
File metadata
- Download URL: release_clean-1.0.3.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c92c43f70fbac848aefd27c1dfffe8357c0026730770519199c7e76308a516d0
|
|
| MD5 |
0ab646bc48a2a3bff4a58c6ddbab6d1e
|
|
| BLAKE2b-256 |
64be88878219bd93e88158150843eb31632ef17a25a542658c6360f7d234b3aa
|
Provenance
The following attestation bundles were made for release_clean-1.0.3.tar.gz:
Publisher:
release.yml on argolo/release-clean
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
release_clean-1.0.3.tar.gz -
Subject digest:
c92c43f70fbac848aefd27c1dfffe8357c0026730770519199c7e76308a516d0 - Sigstore transparency entry: 1258437178
- Sigstore integration time:
-
Permalink:
argolo/release-clean@485e000fbd5d122b7cb95fa956dbb74aad61b6c6 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/argolo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@485e000fbd5d122b7cb95fa956dbb74aad61b6c6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file release_clean-1.0.3-py3-none-any.whl.
File metadata
- Download URL: release_clean-1.0.3-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
519573bc806c531c3d8c289af3c62ab98c2da454a8ef88a4c2a7b5f252b4d092
|
|
| MD5 |
636a68204c074dfbaa309bd7eec6407a
|
|
| BLAKE2b-256 |
896143b9535b57ee074588413cbbd8929e36fb475af1a4cb690d6b0728ed3451
|
Provenance
The following attestation bundles were made for release_clean-1.0.3-py3-none-any.whl:
Publisher:
release.yml on argolo/release-clean
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
release_clean-1.0.3-py3-none-any.whl -
Subject digest:
519573bc806c531c3d8c289af3c62ab98c2da454a8ef88a4c2a7b5f252b4d092 - Sigstore transparency entry: 1258437215
- Sigstore integration time:
-
Permalink:
argolo/release-clean@485e000fbd5d122b7cb95fa956dbb74aad61b6c6 -
Branch / Tag:
refs/tags/v1.0.3 - Owner: https://github.com/argolo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@485e000fbd5d122b7cb95fa956dbb74aad61b6c6 -
Trigger Event:
push
-
Statement type: