Skip to main content

A safety wrapper for git push that prevents accidental pushes to origin without branch name

Project description

hmm - Git Safety Wrapper

A safety wrapper for git push that prevents accidental pushes to origin without a branch name.

What does it do?

Have you ever typed git push origin and immediately regretted it? hmm adds a safety net by requiring 3 explicit confirmations before allowing a push to origin without a branch name.

Before hmm:

$ git push origin
# Oops... pushed to the wrong branch or with unintended behavior

After hmm:

$ git push origin
  DANGER: You are pushing to ORIGIN without a branch!
Type 'yes' to confirm [1/3]: yes
  WARNING: This may overwrite or break things on origin!
Type 'yes' to confirm [2/3]: yes
  FINAL CHECK: Do you really want to do this?
Type 'yes' to confirm [3/3]: no
Push cancelled.

Installation

Method 1: NPM/NPX (Recommended for Node.js users)

# Install globally
npm install -g hmm-git-safety

# Or use npx without installing
npx hmm-git-safety install

Method 2: Python/Pip (Recommended for Python users)

# Install via pip
pip install hmm-git-safety

# Run the installer
hmm install

Method 3: Homebrew (macOS)

# Add the tap (when published)
brew tap yourusername/hmm
brew install hmm

# Or install directly
brew install hmm.rb

Method 4: Direct Shell Script (Universal)

# Download and run installer
curl -fsSL https://raw.githubusercontent.com/yourusername/hmm/main/install.sh | bash

# Or manually
git clone https://github.com/yourusername/hmm.git
cd hmm
chmod +x install.sh
./install.sh

Method 5: GUI Installer (All Platforms)

Download and run the GUI installer:

# Requires Python 3 with tkinter
python3 gui_installer.py

The GUI provides a user-friendly interface for:

  • Installing hmm
  • Uninstalling hmm
  • Checking installation status
  • Viewing installation logs

Usage

Once installed, hmm works automatically. Just use git as normal:

# Safe - specifies branch
git push origin main
git push origin feature-branch

# Dangerous - will trigger 3 confirmations
git push origin

Management Commands

# Check installation status
hmm status

# Uninstall hmm
hmm uninstall

# Get help
hmm help

How it Works

hmm adds a bash/zsh function to your shell configuration file (.zshrc, .bashrc, or .profile) that wraps the git command. When you try to run git push origin without a branch name, it intercepts the command and asks for confirmation three times before proceeding.

The wrapper is lightweight and doesn't affect any other git commands.

Supported Platforms

  • macOS (zsh, bash)
  • Linux (bash, zsh)
  • Windows (via WSL or Git Bash)

Uninstallation

# Using the command
hmm uninstall

# Or using the package manager you used to install
npm uninstall -g hmm-git-safety
pip uninstall hmm-git-safety

# Or using the uninstall script
./uninstall.sh

# Or manually remove the "hmm git safety wrapper" block from your shell config

Configuration Files

hmm automatically detects your shell and modifies the appropriate config file:

  • zsh: ~/.zshrc
  • bash: ~/.bashrc
  • other: ~/.profile

Why "hmm"?

Because when you type git push origin without a branch name, your first thought should be "hmm... is this really what I want to do?"

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - feel free to use this in your own projects!

Roadmap

  • Support for more shells (fish, powershell)
  • Customizable confirmation count
  • Custom warning messages
  • Whitelist specific repositories
  • Integration with git hooks

Support

If you find this useful, please star the repository and share it with your fellow developers who might benefit from an extra safety net!

Disclaimer

This tool is provided as-is. While it adds a safety layer, always be careful with your git commands and understand what they do before executing them.

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

hmm_git_safety-1.0.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

hmm_git_safety-1.0.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file hmm_git_safety-1.0.0.tar.gz.

File metadata

  • Download URL: hmm_git_safety-1.0.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for hmm_git_safety-1.0.0.tar.gz
Algorithm Hash digest
SHA256 174412c0203ba552f904d1b172abfd7ecf32ca7b4e618f860673483c079d5272
MD5 b063dae1180bcb5b3ae21ce37eb3dd0a
BLAKE2b-256 5258cd252eb89f8bfdbf88bf61c69d32cd869bb79a29fd41eb1a90657d306a57

See more details on using hashes here.

File details

Details for the file hmm_git_safety-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: hmm_git_safety-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for hmm_git_safety-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10c75c69960dca25cf6fe5ca9774deb432fe3e7ebb684b4ecd67d75739d5e1b9
MD5 3b5fa47ad92231b3be5efcc8bb7f32b3
BLAKE2b-256 6a3f8755cd8db23e51f9c3307aaa13f2455480ebf6ad12944030348db66d4c9c

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