safety-git-reset-guard

Block destructive Git commands in Bash via PreToolUse hooks.

7|Updated May 28, 2026
One-click install
npx skills add https://github.com/zcaceres/skills --skill safety-git-reset-guard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: safety-git-reset-guard
Source: https://github.com/zcaceres/skills/tree/main/skills/safety-git-reset-guard
Command: npx skills add https://github.com/zcaceres/skills --skill safety-git-reset-guard

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires jq, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This skill prevents catastrophic data loss by intercepting and blocking dangerous Git commands like reset --hard or force-pushes before they execute in your terminal.

Core Features & Use Cases

  • Proactive Guardrails: Automatically detects and blocks destructive patterns including force-deletes, hard resets, and worktree removals.
  • Safe Alternatives: Provides immediate feedback and suggests safer Git workflows, such as using force-with-lease instead of force-push.
  • Use Case: If you accidentally type a command that would wipe your local changes or force-overwrite a remote branch, this skill halts the execution and prompts you to verify your intent.

Quick Start

Install the safety-git-reset-guard skill and run the included install script to enable always-on protection for your terminal.

Frequently Asked Questions about safety-git-reset-guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent accidental git reset --hard or force-push in Bash?

To prevent accidental git reset --hard or force-push in Bash, you can use a PreToolUse hook that intercepts destructive Git commands and blocks them before execution. This validates shell commands against a security-focused regex pattern list to halt data loss.

What is a PreToolUse hook for AI agents?

A PreToolUse hook for AI agents is a security mechanism that operates within Bash environments to validate shell commands. It automatically detects and blocks destructive patterns like force-deletes and worktree removals before they execute in your terminal.

Do I need jq to configure Git safety hooks?

Yes, you need jq installed to configure Git safety hooks in this setup. The dependency is required for idempotent configuration wiring when installing the safety-git-reset-guard skill to enable always-on terminal protection.

Does this Git safety hook work on Windows, macOS, and Linux?

Yes, this Git safety hook works on Windows, macOS, and Linux. It provides cross-platform binary support to intercept and block dangerous Git commands consistently across different operating systems.

What happens when a destructive Git command is intercepted?

When a destructive Git command is intercepted, the execution is halted to prevent data loss and immediate feedback is provided. It suggests safer Git workflows, such as using force-with-lease instead of a standard force-push.

What is the best way to block accidental force-pushes in automated workflows?

The best way to block accidental force-pushes in automated workflows is implementing a PreToolUse hook that validates shell commands against a regex pattern list. This proactively guards against destructive Git commands without manual intervention.