Skip to main content

Automated, paranoid git backups for students and casual coding.

Project description

🔭 Git Pulsar (v0.8.0)

Tests Python 3.12+ License: MIT Ruff Pre-commit

Automated, paranoid git backups for students and casual coding.

Git Pulsar is a background daemon that wakes up every 15 minutes, commits your work to a secluded wip/pulsar branch, and pushes it to your remote. It ensures that even if your laptop dies, your uncommitted work is safe on the server—without polluting your main history.


⚡ Features

  • Set & Forget: Runs silently in the background via launchd (macOS) or systemd (Linux).
  • Non-Intrusive: Commits are pushed to a separate branch (wip/pulsar). Your main branch stays clean.
  • Smart Checks:
    • Detects if the repo is busy (merging/rebasing) and yields.
    • Prevents accidental upload of large files (>100MB).
    • Auto-generates .gitignore for Python/LaTeX projects if missing.
  • System Integration: Native desktop notifications on success or failure.

📦 Installation

macOS (Recommended)

Install via Homebrew to handle the daemon registration automatically.

brew tap jacksonfergusondev/tap
brew install git-pulsar
brew services start git-pulsar

Linux / Generic

Install via uv (or pipx) to isolate the environment, then register the systemd service.

uv tool install git-pulsar
git-pulsar install-service --interval 300  # Optional: Run every 5 mins (default: 900s)

🚀 Usage

1. Activate a Repository

Navigate to any project you want to back up and initialize Pulsar.

cd ~/University/Astro401
git-pulsar

This registers the path in the local registry (~/.git_pulsar_registry) and ensures the wip/pulsar branch exists.

2. Work Normally

You do not need to do anything else. Pulsar wakes up every 15 minutes to:

  1. Check for changes.
  2. Commit them to wip/pulsar.
  3. Push to origin.

3. Manual Backup

If you want to force a backup immediately (e.g., right before closing your laptop), run:

git-pulsar now

4. Monitoring & Control

Pulsar provides tools to check what's happening behind the scenes.

Check Status: See if the background daemon is running and when the last backup happened.

git-pulsar status

View Changes: See exactly what is different between your current work and the last backup (includes untracked files).

git-pulsar diff

Pause Backups: Stop Pulsar from running on a specific repo during heavy refactoring.

git-pulsar pause
# ... do messy work ...
git-pulsar resume

View Logs: Tail the background service logs in real-time.

git-pulsar log

5. Restore a File

If you messed up a file and need to grab the latest version from the backup:

git-pulsar restore src/main.py

This pulls the file from wip/pulsar into your working directory. It will warn you if you have uncommitted changes.

6. Finalize Your Work

When you are ready to submit or merge your work back to main:

git-pulsar finalize

This automates the squashing process: it switches to main, merges your backup history into a single commit, and resets the backup branch so you are ready for the next assignment.

⚙️ Configuration

You can customize global behavior by creating ~/.config/git-pulsar/config.toml.

Default Configuration:

[core]
backup_branch = "wip/pulsar"
remote_name = "origin"

[limits]
# 5MB log rotation
max_log_size = 5242880
# Skip files larger than 100MB
large_file_threshold = 104857600

🛑 Stopping the Service

To deregister the background daemon and stop all backups:

git-pulsar uninstall-service

🔧 Requirements

  • Python 3.12+
  • Headless Auth: Your git authentication must be non-interactive (SSH keys or a cached Credential Helper). Pulsar runs in the background and cannot prompt for passwords.

🛠️ Development

This project uses modern Python tooling.

  1. Clone and Install Dependencies:

    git clone https://github.com/jacksonferguson/git-pulsar.git
    cd git-pulsar
    uv sync
    
  2. Setup Pre-commit Hooks:

    pre-commit install
    
  3. Run Tests: We use pytest for testing and hypothesis for property-based testing.

    uv run pytest
    

📂 Project Structure

.
├── LICENSE
├── pyproject.toml
├── README.md
├── uv.lock
├── src
│   ├── __init__.py
│   ├── cli.py         # Entry point & repo setup logic
│   ├── daemon.py      # Core backup loop & git operations
│   └── service.py     # Background service installer (launchd/systemd)
└── tests
    ├── test_cli.py
    ├── test_daemon.py
    └── test_properties.py

📄 License

This project is licensed under the MIT License.

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_pulsar-0.8.0.tar.gz (57.9 kB view details)

Uploaded Source

Built Distribution

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

git_pulsar-0.8.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file git_pulsar-0.8.0.tar.gz.

File metadata

  • Download URL: git_pulsar-0.8.0.tar.gz
  • Upload date:
  • Size: 57.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for git_pulsar-0.8.0.tar.gz
Algorithm Hash digest
SHA256 24892cc2a38725ba593f7042cad79015e417c9c32df260bfc29cc8400cc792e8
MD5 97a2bf479ee4b97fd309f5db4e3544c2
BLAKE2b-256 2e82f071a83755ab8949088a8452d61da1a95eec1901419b8bad6ddf2ee5f904

See more details on using hashes here.

File details

Details for the file git_pulsar-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: git_pulsar-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for git_pulsar-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f36cc646bd6ae60c6a23dcf700debceab6654f0b67373f1c3609cbca9b5973d3
MD5 348deddbbb0868d6fe1796863c20cde8
BLAKE2b-256 8f9a7d8adec1ed321646459ef9a1c4481ff259bd568ecbe6280cfd3e04b466a7

See more details on using hashes here.

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