Check what's not backed up in your Git repository before you delete it.
Project description
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)
Project details
Release history Release notifications | RSS feed
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 git_ok-0.1.0.tar.gz.
File metadata
- Download URL: git_ok-0.1.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8716e2bd7ce67246f9143f2b1353ff16f8a8e780f929f870fe1cf1a265aa433a
|
|
| MD5 |
332a9b00e6e9af49ec5a5535042067cf
|
|
| BLAKE2b-256 |
e17dffab6639ae6780d1df4076c916cdf691e6e20710931660a5ea93c4872369
|
Provenance
The following attestation bundles were made for git_ok-0.1.0.tar.gz:
Publisher:
publish.yml on dongzhenye/git-ok
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_ok-0.1.0.tar.gz -
Subject digest:
8716e2bd7ce67246f9143f2b1353ff16f8a8e780f929f870fe1cf1a265aa433a - Sigstore transparency entry: 708775461
- Sigstore integration time:
-
Permalink:
dongzhenye/git-ok@14e6e8ec8071ce40aba800de97e09d5a5d198561 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dongzhenye
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14e6e8ec8071ce40aba800de97e09d5a5d198561 -
Trigger Event:
release
-
Statement type:
File details
Details for the file git_ok-0.1.0-py3-none-any.whl.
File metadata
- Download URL: git_ok-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87874b02a16ced6f6c737d9432cfd715c44c329318cba4c452a861009a4a29cc
|
|
| MD5 |
d7275d54469d80825761967d665633e1
|
|
| BLAKE2b-256 |
2a2e55053cc68504986c933a53eeb80e470518b0966249eb7b0f2bc3002da209
|
Provenance
The following attestation bundles were made for git_ok-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on dongzhenye/git-ok
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
git_ok-0.1.0-py3-none-any.whl -
Subject digest:
87874b02a16ced6f6c737d9432cfd715c44c329318cba4c452a861009a4a29cc - Sigstore transparency entry: 708775463
- Sigstore integration time:
-
Permalink:
dongzhenye/git-ok@14e6e8ec8071ce40aba800de97e09d5a5d198561 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/dongzhenye
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14e6e8ec8071ce40aba800de97e09d5a5d198561 -
Trigger Event:
release
-
Statement type: