Skip to main content

PyPI version License - MIT 3-Clause PyPI Downloads Visitors

ezgit-sync

  ___ ______ _(_) |_      ___ _   _ _ __   ___ 
 / _ \_  / _` | | __|____/ __| | | | '_ \ / __|
|  __// / (_| | | ||_____\__ \ |_| | | | | (__ 
 \___/___\__, |_|\__|    |___/\__, |_| |_|\___|
         |___/                |___/          

Description

Designed for data scientists and ML/DL practitioners, this library automates routine Git operations to accelerate your development cycle.

Features

  • Automated Git Workflow: Pulls remote changes, commits local work, and pushes to the remote repository in a single command.
  • Branch Awareness: Automatically detects and operates on your current Git branch.
  • Intelligent Syncing: Checks for local modifications before committing and avoids unnecessary operations if there's nothing to sync.
  • Custom Commit Messages: Specify a commit message for your sync via the command line.
  • User-Friendly Logging: Provides clear, color-coded terminal output for success, warnings, and info.
  • Detailed Error Handling: Offers descriptive error messages with common reasons and suggested solutions to help you troubleshoot quickly.

Installation

You can install ezgit-sync directly from PyPI using standard package managers:

pip install ezgit-sync

If you are using uv (as in your development environment), you can also install it via:

uv pip install ezgit-sync

Usage Examples

Basic Usage

sync_local_changes(repo_root, branch, commit_message)

Stages all current modifications (git add -A), creates a commit with the provided message, and pushes the commits to the remote branch.

try:
    sync_local_changes(Path("."), "main", "Automated model weights update")
    print("Sync complete!")
except Exception:
    print("Sync failed during push.")
CLI Usage
ezgit-sync

Under the hood, this will:

  • Verify you are in a Git repository (verify_git_repository).
  • Identify your current branch (get_current_branch).
  • Pull the latest remote changes (pull_remote_changes).
  • Stage all local modifications (has_local_changes). Commit with a default message (e.g., "Auto-sync via ezgit-sync") and push to the remote (sync_local_changes).
Complete Workflow Example
from pathlib import Path

def run_ezgit_sync(message: str = "Automated sync"):
    repo_root = Path.cwd()
    
    # 1. Ensure we are in a Git repository
    if not verify_git_repository(repo_root):
        return

    # 2. Get the current branch
    try:
        branch = get_current_branch(repo_root)
    except Exception:
        return

    # 3. Pull latest changes to avoid conflicts
    if not pull_remote_changes(repo_root, branch):
        return

    # 4. Check for local changes and push if necessary
    if has_local_changes(repo_root):
        try:
            sync_local_changes(repo_root, branch, message)
            log_success(f"Successfully synced branch '{branch}'!")
        except Exception:
            # The function already logged the specific error
            pass
    else:
        log_info("Everything is up-to-date. Nothing to commit.")

# Execute the workflow
run_ezgit_sync(message="Update ResNet training script")

Development

To set up for local development:

# Clone your fork
git clone git@github.com:your_username/ezgit-sync.git
cd ezgit-sync

# Install dependencies
uv sync

# Create a branch for development
git checkout -b feature/new-awesome-feature

Author

ezgit-sync was created in 2026 by Hasan Ali Özkan.

Credits

Built with Cookiecutter and the audreyfeldroy/cookiecutter-pypackage project template.

Release files for ezgit-sync 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ezgit-sync 0.1.3
File Size Uploaded
ezgit_sync-0.1.3.tar.gz 17.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ezgit-sync 0.1.3
File Interpreter ABI Platform
ezgit_sync-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 21.5 kB

Release files / ezgit_sync-0.1.3.tar.gz

Download URL ezgit_sync-0.1.3.tar.gz
Size 17.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fb01e4573e8b8b09be64eb0fc7c62b483746d0fc9e547fe3e9ab2a97a2f478c1
BLAKE2b-256 checksum
How to use checksums
34d88d5db7a7845ee5b2ac1500e79671be0b1a11fc6dcc55e3d79e115d5fdb44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / ezgit_sync-0.1.3-py3-none-any.whl

Download URL ezgit_sync-0.1.3-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2301d1208e9d33bd19ec592f9e1514ae9104a4053edee407d050237dc540858
BLAKE2b-256 checksum
How to use checksums
b312883b289532ba51dbd2813b03caa88ecd09b823668360a8c31eb4d9cee650
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.0 {"installer":{"name":"uv","version":"0.12.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page