git-safety

Block unsafe Git operations on protected branches during commits, pushes, merges, rebases, resets, and deletions.

8.7k|482|Updated Jul 30, 2021
One-click install
npx skills add https://github.com/redis/RedisInsight --skill git-safety-redis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-safety
Source: https://github.com/redis/RedisInsight/tree/main/.ai/skills/git-safety
Command: npx skills add https://github.com/redis/RedisInsight --skill git-safety-redis

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents accidental destructive or policy-violating Git actions against protected branches like main, latest, and release/*, reducing the risk of breaking production or release workflows.

Core Features & Use Cases

  • Protected Branch Guardrails: Enforces non-negotiable rules that block commits, pushes, merges, rebases, resets, and history rewrites on protected branches.
  • Safe Required Workflow: Guides creating a feature branch and using Pull Requests instead of direct changes to protected branches.
  • Pre-Push Validation & Recovery: Includes a branch-target verification checklist and defines an error recovery path using stashing and branch switching.

Quick Start

Use this skill to validate your planned Git actions and ensure you are on a non-protected branch before attempting any push, force-push, merge, rebase, reset, or release-branch deletion.

Frequently Asked Questions about git-safety

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

FAQPage Schema
How do I prevent force push and history rewrites on protected branches?

To prevent force push and history rewrites on protected branches, you need guardrails that enforce strict branch-based restrictions blocking commits, pushes, merges, rebases, and resets on branches like main and release/*.

What is the safe pull request workflow for feature development?

The safe pull request workflow for feature development requires verifying the current branch, creating a dedicated feature branch, and routing all changes through Pull Requests rather than direct protected-branch writes to ensure safe release workflows.

How do I validate my planned git actions before pushing to a release branch?

To validate planned git actions before pushing to a release branch, use a pre-push branch-target verification checklist that ensures you are on a non-protected feature branch before attempting any merge, rebase, or reset.

What happens if I accidentally commit to a protected branch like main?

If you accidentally commit to a protected branch like main, the defined error recovery path uses stashing and branch switching to safely move your changes to a feature branch without breaking production or release workflows.

When do I need protected branch guardrails for my release workflow?

You need protected branch guardrails for your release workflow whenever an AI agent or automated process must reason about branch targeting and history-rewrite commands, reducing the risk of breaking production or release branches.