Skip to content
Skills Library
Programming · Automation

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.

Licence
MIT
Last repository change
17.07.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 17.07.2026, without references to retired models or APIs.

Licence

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

  1. When to use
  2. The problem it solves
  3. Solution
  4. Usage
  5. Rules to prevent chaos
Original SKILL.md headings · 42 lines, 203 words
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.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.