git-safety-check

Check git branch, working tree, remotes, and submodules before destructive operations.

6|Updated Mar 11, 2026
One-click install
npx skills add https://github.com/open-hax/opencode-skills --skill git-safety-check
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-safety-check
Source: https://github.com/open-hax/opencode-skills/tree/main/.opencode/skills/git-safety-check
Command: npx skills add https://github.com/open-hax/opencode-skills --skill git-safety-check

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Protocol to ensure safe git operations and avoid detached HEAD or dirty commits.

Core Features & Use Cases

  • Check status
  • Confirm current branch
  • Handle detached HEAD by creating a temporary branch
  • Validate remotes
  • Submodule awareness

Quick Start

Run a safety check before git operations to ensure you are on the correct branch and there is no detached HEAD.

Frequently Asked Questions about git-safety-check

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

FAQPage Schema
How do I prevent a detached HEAD when switching git branches?

Prevent a detached HEAD by running a git safety check that verifies the active branch with git branch --show-current and automatically creates a protective temporary branch if HEAD is detached.

What is the best way to ensure my git working tree is clean before a rebase?

The best way to ensure a clean git working tree before a rebase is to run a safety check using git status to validate the working directory and flag any submodule cleanliness issues.

How do I validate git remotes before pushing a branch reset?

Validate git remotes before pushing a branch reset by running a safety check that executes git remote -v to confirm remote repository configurations and ensure correct push targets.

Why does my git workflow risk destructive states after history diverges?

Your git workflow risks destructive states after history diverges because the active branch becomes uncertain; a safety check mitigates this by enforcing branch verification and working tree cleanliness.

Can I check submodule cleanliness during a git branch switch?

Yes, you can check submodule cleanliness during a git branch switch by running a safety protocol that flags submodule status alongside verifying the active branch and working tree state.

When should I run a git safety check for risk management?

Run a git safety check for risk management before executing rebase, reset, or branch-switch workflows where the active branch is uncertain, history diverges, or a dirty working tree may cause data loss.