push-to-main

Fast-forward git worktree changes to main or master and push them.

Updated Feb 17, 2026
One-click install
npx skills add https://github.com/wolfmanstout/agent-skills --skill push-to-main-wolfmanstout
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: push-to-main
Source: https://github.com/wolfmanstout/agent-skills/tree/main/src/push-to-main
Command: npx skills add https://github.com/wolfmanstout/agent-skills --skill push-to-main-wolfmanstout

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Publishing work from an alternate git worktree to the primary branch is error-prone: uncommitted changes get lost, non-fast-forward merges create conflicts, and unrelated user work can be accidentally staged. This Skill enforces a safe, deterministic sequence for committing the current worktree, fast-forwarding main/master, and pushing without bypassing branch history. ## Core Features & Use Cases - Worktree-safe publishing: Commits the current worktree first, then updates the main worktree only via git merge --ff-only, never overwriting uncommitted changes. - Guardrailed git operations: Refuses to force-push, stash, reset, rebase, or create pull requests unless the user explicitly asks, and stops cleanly when fast-forwarding fails. - Detached HEAD and upstream handling: Works with detached worktrees by using the HEAD commit as the merge target, and only pushes the current branch when it already has an upstream. - Use Case: You finished a feature in a secondary worktree created with git worktree add. Ask the agent to push to main, and it commits your work, fast-forwards the main worktree, pushes main, and returns you to your original directory. ## Quick Start Ask the agent to commit the current worktree, fast-forward main to its HEAD, and push it to the remote.

Frequently Asked Questions about push-to-main

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

FAQPage Schema
How do I push changes from a git worktree to main?

Commit your changes in the current worktree, then switch to the main worktree and run git merge --ff-only with your branch or HEAD commit, followed by git push origin main. This Skill automates that sequence while checking for clean state at each step.

How to merge a branch into main without a pull request?

Use git merge --ff-only from the main worktree to fast-forward main to your branch, then push directly to the remote. This preserves linear history and skips the pull request flow entirely.

Can I push to main from a detached HEAD worktree?

Yes. The workflow uses the current HEAD commit SHA as the merge target when the worktree is detached, leaving it detached. It fast-forwards main to that commit and pushes without requiring a named branch.

What happens if main cannot be fast-forwarded to my branch?

The workflow stops and reports that main cannot be fast-forwarded to your branch or HEAD commit. It does not rebase, create merge commits, or force-push; conflict resolution decisions are left to you.

Does this workflow force-push or overwrite uncommitted changes?

No. It never uses force-push, git reset --hard, stash, or branch deletion unless explicitly requested. If the main worktree has uncommitted changes, it stops and reports the dirty files instead of overwriting them.