git-pending-push-guard

Blocks git push while MERGE_HEAD, CHERRY_PICK_HEAD, or REVERT_HEAD states remain unresolved.

Updated Mar 22, 2026
One-click install
npx skills add https://github.com/diazMelgarejo/orama-system --skill git-pending-push-guard-diazmelgarejo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-pending-push-guard
Source: https://github.com/diazMelgarejo/orama-system/tree/main/bin/orama-system/skills/git-pending-push-guard
Command: npx skills add https://github.com/diazMelgarejo/orama-system --skill git-pending-push-guard-diazmelgarejo

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? After a --no-commit merge, cherry-pick, or revert, Git leaves pending state files (MERGE_HEAD, CHERRY_PICK_HEAD, REVERT_HEAD) in the repository. Pushing in this state produces empty or broken pull requests and confusing history. This Skill detects those pending operations and blocks the push before damage occurs. ## Core Features & Use Cases - Pending Operation Detection: Runs scripts/git/check_no_pending_merge.sh to inspect Git state files and returns exit codes 0-4 distinguishing clean merges, conflicted merges, cherry-picks, and reverts. - Pre-Push Hook Integration: Installs as a .githooks/pre-push hook so every push is automatically validated with GIT_PUSH_E_PENDING_* error codes. - History Surgery Exception: Documents when to temporarily disable hooks during active filter-repo or filter-branch rewrites using git -c core.hooksPath=/dev/null push --force-with-lease. - Use Case: You run git merge --no-commit feature-x, get interrupted, and later attempt git push. The guard exits with code 1 (GIT_PUSH_E_PENDING_MERGE_CLEAN), preventing an empty PR like the periscope PR #39 incident. ## Quick Start Ask the agent to check whether any pending merge, cherry-pick, or revert is blocking my git push and explain the exit code.

Frequently Asked Questions about git-pending-push-guard

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

FAQPage Schema
How do I check for a pending merge before git push?

Run scripts/git/check_no_pending_merge.sh before pushing. It exits 0 when the repository is clean and exits 1-4 when MERGE_HEAD, CHERRY_PICK_HEAD, or REVERT_HEAD indicates an unfinished merge, cherry-pick, or revert.

Why is my pull request empty after a git merge?

An empty PR after merge usually means a --no-commit merge left MERGE_HEAD set and the merge was never committed, so git diff base...head shows almost nothing. Complete or abort the pending merge with git merge --continue or git merge --abort before pushing.

What do GIT_PUSH_E_PENDING exit codes 1-4 mean?

Exit 1 is GIT_PUSH_E_PENDING_MERGE_CLEAN, exit 2 is GIT_PUSH_E_PENDING_MERGE_CONFLICT, exit 3 is GIT_PUSH_E_PENDING_CHERRY_PICK, and exit 4 is GIT_PUSH_E_PENDING_REVERT. Exit 0 (GIT_PUSH_OK) means the push is safe to proceed.

Can I disable pre-push hooks during git filter-repo history rewrites?

Yes, during active history surgery disable hooks with git -c core.hooksPath=/dev/null push --force-with-lease origin <branch>, because preventive hooks false-block multi-branch force pushes. Reinstall hooks with scripts/git/install-local-hooks.sh before the next normal commit.

Does this pre-push guard work with cherry-pick and revert states?

Yes, the guard detects CHERRY_PICK_HEAD and REVERT_HEAD in addition to MERGE_HEAD. Any unfinished cherry-pick or revert from a --no-commit operation blocks the push with exit codes 3 or 4 respectively.