github-safe-push
/github-safe-push
Push files to a GitHub repo WITHOUT git branch chaos — uses the GitHub Contents API (PUT) directly, bypassing local git state. Use when local git branches are messy, commits landed on wrong branch, or you need idempotent repo updates. Created after esp-hermes branch-hell.
- Author
- ohrbit ↗
- Repository
- hermes_plugins ↗
- Licence
- MIT
- Last repository change
- 17.07.2026
Assessment and security
- Files in this package
- 1
- Scripts
- 0
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 17.07.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
What it does and when to use it
Push files to a GitHub repo WITHOUT git branch chaos — uses the GitHub Contents API (PUT) directly, bypassing local git state. Use when local git branches are messy, commits landed on wrong branch, or you need idempotent repo updates. Created after esp-hermes branch-hell.
Original author description
Push files to a GitHub repo WITHOUT git branch chaos — uses the GitHub Contents API (PUT) directly, bypassing local git state. Use when local git branches are messy, commits landed on wrong branch, or you need idempotent repo updates. Created after esp-hermes branch-hell.
How it works
- When to use
- The problem it solves
- Solution
- Usage
- Rules to prevent chaos
SKILL.md preview
---
name: github-safe-push
description: "Push files to a GitHub repo WITHOUT git branch chaos — uses the GitHub Contents API (PUT) directly, bypassing local git state. Use when local git branches are messy, commits landed on wrong branch, or you need idempotent repo updates. Created after esp-hermes branch-hell."
---
# GitHub Safe Push (API-based, no branch chaos)
## When to use
- Local git repo is in branch hell (multiple stale branches, commits on wrong branch)
- You need to push specific files to `main` reliably
- Idempotent re-pushes (update existing file = 200, not conflict)
## The problem it solves
`git push origin <localbranch>:main` with wrong local checkout → commits land
on wrong branch, local `main` goes stale, files missing, double-nested dirs
(`esp-hermes/esp-hermes/`). We hit this on the esp-hermes firmware push.
## Solution
`/root/.hermes/scripts/gh_push_safe.py` — pushes via GitHub Contents API
(`PUT /repos/{owner}/{repo}/contents/{path}`). No local git state involved.
Reads `GITHUB_TOKEN` from `/root/.hermes/.env`.
## Usage
```bash
# single file
python3 /root/.hermes/scripts/gh_push_safe.py <local_file> <repo_path> [msg]
# whole dir (recursive)
python3 /root/.hermes/scripts/gh_push_safe.py --dir <local_dir> <repo_prefix> [msg]
```
Example:
```bash
python3 /root/.hermes/scripts/gh_push_safe.py \
esp-hermes/firmware/main/io_tools.c \
esp-hermes/firmware/main/io_tools.c \
"fix: v6 compat"
```
## Rules to prevent chaos
1. **Prefer API push** over `git push X:main` for single-file updates.
2. Before any `git push`, run `git branch` + `git status` to confirm checkout.
3. Never `mkdir -p <repo>` inside an already-cloned `<repo>/` — causes nesting.
4. Delete stale branches after merge: `git branch -D esp-hermes-*`.
5. Verify after push: `curl -s -o /dev/null -w "%{http_code}" <api_url>` → 200.
Versions
The database has no other skills named github-safe-push.
Database snapshot: 13.11.2026 · package version 13437b0ec2f8 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100push-to-pr
Push commits to an existing GitHub PR's source branch. NEVER create new branches. Use when the user says "push to PR #N", "push到PR", or any variation meaning to push local commits onto an existing pull request. Covers finding the PR's head branch via GitHub API, setting up the… - 100git-push
Push local commits to remote — handles branch tracking, upstream setup, safe push patterns. Use when user says "push", "send to remote", or "update remote". Pushes existing commits — see git-commit for commits and git-pr for PR creation. - 100github
Clone and push the user's GitHub repositories with git, and work with issues, pull requests, and files through the GitHub API with den fetch. Use for any task on GitHub. - 100git-api-pr
GitHub API PR creation without local git. Use when submitting file changes as a PR without local commits — quick fixes, typos, config updates, or bypassing local git state. - 100git-github
Use for any git or GitHub operation in the team repo — creating the repo from the template, branches, PRs with gh, issues, resolving conflicts, and recovering from mistakes. - 100git-cleanup
Use when the user explicitly invokes branch or worktree cleanup for a repo with accumulated local branches. Don''t use for remote branch deletion or force-push operations.