Skip to main content

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 .env files 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

  1. Non-Git Directory - Most critical! No version control at all

    ❌ NOT A GIT REPOSITORY!
    All 156 files (2.3 MB) are NOT backed up!
    
  2. Orphaned Local Repository - No remote configured with local commits

    ⚠️  No remote repository configured! (2 local commits)
    
  3. Database Files - Local SQLite databases that might contain important data

    ⚠️  Important config/secret files:
       - addresses.db
    
  4. Environment Files - Configuration files with API keys or secrets

    ⚠️  Important config/secret files:
       - .env.local
       - .claude/settings.local.json
    
  5. Large Node.js Projects - Smart filtering to avoid false positives

    • Ignores node_modules/ and build directories
    • Focuses on actual config files, not source code

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.md for 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:

  1. Uncommitted work that would be lost
  2. Unpushed commits that exist only locally
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

git_ok-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

git_ok-0.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

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

Hashes for git_ok-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8716e2bd7ce67246f9143f2b1353ff16f8a8e780f929f870fe1cf1a265aa433a
MD5 332a9b00e6e9af49ec5a5535042067cf
BLAKE2b-256 e17dffab6639ae6780d1df4076c916cdf691e6e20710931660a5ea93c4872369

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_ok-0.1.0.tar.gz:

Publisher: publish.yml on dongzhenye/git-ok

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for git_ok-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87874b02a16ced6f6c737d9432cfd715c44c329318cba4c452a861009a4a29cc
MD5 d7275d54469d80825761967d665633e1
BLAKE2b-256 2a2e55053cc68504986c933a53eeb80e470518b0966249eb7b0f2bc3002da209

See more details on using hashes here.

Provenance

The following attestation bundles were made for git_ok-0.1.0-py3-none-any.whl:

Publisher: publish.yml on dongzhenye/git-ok

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page