git-ok
A tool to check what's not backed up in your Git repository.
Why git-ok?
When managing multiple local repositories, it's common to want to clean up old projects. However, before deleting a repository, you need to ensure:
- All changes are committed and pushed
- No valuable local configuration files (like
.envfiles with secrets) will be lost - The local branch is fully synced with remote
This tool provides a comprehensive check for all these concerns in one simple command.
Real-world Scenarios
-
Non-Git Directory - Most critical! No version control at all
❌ NOT A GIT REPOSITORY! All 156 files (2.3 MB) are NOT backed up! -
Orphaned Local Repository - No remote configured with local commits
⚠️ No remote repository configured! (2 local commits) -
Database Files - Local SQLite databases that might contain important data
⚠️ Important config/secret files: - addresses.db -
Environment Files - Configuration files with API keys or secrets
⚠️ Important config/secret files: - .env.local - .claude/settings.local.json -
Large Node.js Projects - Smart filtering to avoid false positives
- Ignores
node_modules/and build directories - Focuses on actual config files, not source code
- Ignores
Design Principles
- Check non-Git directories too: The riskiest projects have no version control at all, so we treat that as the highest severity.
- Be explicit: Surface every class of risk (uncommitted work, ignored secrets, unsynced commits) so nothing is hidden.
- Stay read-only: The tool never mutates your repo; it only reports, so you stay in control.
- Keep it simple: No config files or setup hoops—clone once, or install the packaged CLI, and you're good to go.
Why the name?
“git-ok” answers the exact question users ask before deleting a project: “Is this repo OK to remove?” The name stuck because it’s short, memorable, and mirrors the command’s yes/no verdict.
Features
- Non-Git Directory Detection: Warns when directories have NO version control at all (most critical!)
- Uncommitted Changes Detection: Identifies staged, unstaged, and untracked files
- Remote Sync Status: Checks if your local branch is ahead or behind the remote
- Ignored Files Listing: Shows all files ignored by
.gitignore(crucial for finding local configs) - Clean Output: Clear, emoji-enhanced terminal output for easy reading
- JSON Support: Machine-readable output for automation
Quick Start
# Clone the repository
git clone https://github.com/dongzhenye/git-ok.git
cd git-ok
# Run directly with Python
python3 git_ok.py /path/to/repo
# Or make it executable
chmod +x git_ok.py
./git_ok.py /path/to/repo
Want the git-ok command available everywhere? Jump down to Installation.
Installation
From PyPI (recommended)
Install the published package to add git-ok to your PATH:
pip install git-ok
# or, for isolation
pipx install git-ok
From the cloned repository
If you are hacking on the project locally, install the current checkout:
pip install .
# or
pipx install --force .
Both methods install the same console script entry point; rerun the same command with --force/--upgrade after pulling new changes to refresh the binary.
Curious about broader distribution plans (Homebrew, curl installers, packages, etc.)? See
docs/distribution.mdfor the maintainer-focused roadmap and reasoning.
Usage
Basic Check
# Check current directory
git-ok
# Check specific repository
git-ok /path/to/repo
Show Ignored Files
This is especially useful for finding important local configuration files:
git-ok --show-ignored
JSON Output
For scripting and automation:
git-ok --json
Example Output
📁 Repository: /Users/example/my-project
============================================================
⚠️ Issues found:
- Uncommitted changes found
- Not in sync with remote
🔄 Sync Status:
Local branch is 2 commits ahead of remote
📝 Uncommitted Changes:
Modified files:
src/main.py
Untracked files:
.env.local
notes.txt
🚫 Ignored Files: 5 files
Files ignored by .gitignore:
- .env
- .env.local
- node_modules/
- *.log
- .DS_Store
============================================================
⚠️ WARNING: This repository has unsynced changes!
Review the above before deleting this repository.
Safety First
The tool helps you identify:
- Uncommitted work that would be lost
- Unpushed commits that exist only locally
- Ignored files that might contain important data (API keys, local configs, etc.)
Always review the output carefully before deleting any repository!
Requirements
- Python 3.6+
- Git command-line tool
- Unix-like environment (Linux, macOS, WSL)
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details
Author
Zhenye Dong (@dongzhenye)
Metadata
Release files for git-ok 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| git_ok-0.1.0.tar.gz | 9.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| git_ok-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.4 kB
Release files / git_ok-0.1.0.tar.gz
| Download URL | git_ok-0.1.0.tar.gz |
|---|---|
| Size | 9.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8716e2bd7ce67246f9143f2b1353ff16f8a8e780f929f870fe1cf1a265aa433a
|
|
BLAKE2b-256 checksum How to use checksums |
e17dffab6639ae6780d1df4076c916cdf691e6e20710931660a5ea93c4872369
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2025.
Transparency logRelease files / git_ok-0.1.0-py3-none-any.whl
| Download URL | git_ok-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87874b02a16ced6f6c737d9432cfd715c44c329318cba4c452a861009a4a29cc
|
|
BLAKE2b-256 checksum How to use checksums |
2a2e55053cc68504986c933a53eeb80e470518b0966249eb7b0f2bc3002da209
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2025.
Transparency logSecurity for git-ok 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for git_ok-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 19, 2025.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.