git-push-secondary-merge-primary
Skill18 starsChanged 7 days agoMITView on GitHub
Use when committing and pushing a work branch, then merging it into the primary branch and pushing both branches.
- Commits and pushes
In this repository55 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ax-extract-workflowSkill
- conversation-json-to-mdSkill
- feature-doc-splitterSkill
- frontend-quality-guardrailsSkill
- git-commit-onlySkill
- git-pushing-fastSkill
- git-stepwise-commitSkill
- git-weekly-reportSkill
- linkedinSkill
- logo-design-boardSkill
- mac-software-storage-cleanupSkill
- multi-lang-readmeSkill
- novel-writerSkill
- react-component-hook-guidelinesSkill
- routerbase-api-integrationSkill
- routerbase-media-generationSkill
- routerbase-model-routingSkill
- topic-bookmarks-reorganizerSkill
- tree-ring-memorySkill
- tweetclaw-twitter-automationSkill
- ui-layout-analyzerSkill
- wechat-theme-extractorSkill
- weixin-article-to-obsidianSkill
- xquik-dataSkill
- x-twitter-scraperSkill
- yuque-lakebook-exportSkill
- ax-extract-workflow-cnSkill
- conversation-json-to-md-cnSkill
- feature-doc-splitter-cnSkill
- frontend-quality-guardrails-cnSkill
- git-commit-only-cnSkill
- git-pushing-fast-cnSkill
- git-push-secondary-merge-primary-cnSkill
- git-stepwise-commit-cnSkill
- git-weekly-report-cnSkill
- linkedin-cnSkill
- logo-design-board-cnSkill
- mac-software-storage-cleanup-cnSkill
- multi-lang-readme-cnSkill
- novel-writer-cnSkill
- react-component-hook-guidelines-cnSkill
- routerbase-api-integration-cnSkill
- routerbase-media-generation-cnSkill
- routerbase-model-routing-cnSkill
- topic-bookmarks-reorganizer-cnSkill
- tree-ring-memory-cnSkill
- tweetclaw-twitter-automation-cnSkill
- ui-layout-analyzer-cnSkill
- wechat-theme-extractor-cnSkill
- weixin-article-to-obsidian-cnSkill
- xquik-data-cnSkill
- x-twitter-scraper-cnSkill
- yuque-lakebook-export-cnSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
25 rules. About 0 are common, 16 are distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈16
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 12
Use "secondary branch" for the branch that contains the current work, such as dev, develop, or another integration branch.
- Distinctive: line 18
Use this skill when the user asks for:
- Distinctive: line 26
Do not use this skill for:
- Distinctive: line 34
Follow the branch detection rules first, then execute the workflow in order.
- Distinctive: line 38
Prefer explicit branch names from the user.
- Very specific: line 39
If the user says dev or main but the repository uses develop or master, inspect actual branches before choosing.
- Distinctive: line 41
If remote HEAD is unavailable, prefer an existing main, then master.
- Very specific: line 43
If currently on the primary branch and no secondary branch was specified, prefer an existing dev, then develop.
- Distinctive: line 44
If the branches still cannot be determined safely, ask the user for the primary and secondary branch names.
- Distinctive: line 48
Follow the workflow below exactly, preserving user changes and stopping on unsafe branch, merge, or push conditions.
- Distinctive: line 53
Run git status --short, git branch --show-current, and git remote -v.
- Distinctive: line 54
Ensure the worktree belongs to the intended repository.
- Distinctive: line 55
Never discard or revert user changes.
- Very specific: line 59
If already on <secondary_branch>, continue.
- Distinctive: line 60
If on another branch with a dirty worktree, switch only when Git allows it cleanly.
- Very specific: line 61
If on another clean branch, run git checkout <secondary_branch> and git pull --ff-only origin <secondary_branch>.
- Very specific: line 63
Commit <secondary_branch> if there are local changes.
- Very specific: line 66
Do not use --no-verify.
- Distinctive: line 67
If hooks or checks fail, fix the issue before committing.
- Very specific: line 68
If <secondary_branch> has no local changes, skip commit and continue to push.
- Distinctive: line 72
If the push is rejected because the remote moved, fetch and inspect before retrying.
- Very specific: line 77
Run git merge --no-ff <secondary_branch> -m "chore(<primary_branch>): merge <secondary_branch> into <primary_branch>" to preserve a merge …
- Distinctive: line 78
If there are merge conflicts, stop after Git reports them and tell the user which files need resolution.
- Distinctive: line 85
Verify with git status --short and git branch --show-current.
- Distinctive: line 91
Keep the final response concise.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Git Push Secondary Merge Primary
Overview
Execute the standard two-branch handoff: finish work on the secondary branch, push it, merge it into the primary branch, push the primary branch, then return to the secondary branch.
Use "secondary branch" for the branch that contains the current work, such as dev, develop, or another integration branch. Use "primary branch" for the protected/release branch, such as main or master.
This workflow is for safe release-sync handoffs where both branches need to be pushed and the primary branch should preserve a clear merge result.
When to Use
Use this skill when the user asks for:
- Pushing the work branch and then merging into the release branch
- A two-branch release-sync workflow such as
dev→mainordevelop→master - Finishing a feature on a secondary branch and propagating it to the primary branch
- Keeping a clean merge commit on the primary branch while preserving the secondary branch history
Do Not Use
Do not use this skill for:
- Single-branch commit/push (use a normal commit + push flow)
- Force-pushing, history rewriting, or rebasing operations
- Generating reports from git history (use
git-weekly-reportinstead) - Reviewing code changes (use
code-reviewerorfrontend-code-reviewinstead)
Instructions
Follow the branch detection rules first, then execute the workflow in order. Stop and report the blocker instead of guessing when branch names, merge conflicts, dirty worktrees, or rejected pushes cannot be handled safely.
Branch Detection
- Prefer explicit branch names from the user.
- If the user says
devormainbut the repository usesdevelopormaster, inspect actual branches before choosing. - Detect the primary branch with
git symbolic-ref refs/remotes/origin/HEADwhen available. - If remote HEAD is unavailable, prefer an existing
main, thenmaster. - Detect the secondary branch from the current branch when it is not the primary branch.
- If currently on the primary branch and no secondary branch was specified, prefer an existing
dev, thendevelop. - If the branches still cannot be determined safely, ask the user for the primary and secondary branch names.
Instructions
Follow the workflow below exactly, preserving user changes and stopping on unsafe branch, merge, or push conditions.
Workflow
- Inspect repository state.
- Run
git status --short,git branch --show-current, andgit remote -v. - Ensure the worktree belongs to the intended repository.
- Never discard or revert user changes.
- Determine
<secondary_branch>and<primary_branch>using the branch detection rules.
- Run
- Move work onto
<secondary_branch>.- If already on
<secondary_branch>, continue. - If on another branch with a dirty worktree, switch only when Git allows it cleanly; otherwise stop and explain the blocker.
- If on another clean branch, run
git checkout <secondary_branch>andgit pull --ff-only origin <secondary_branch>.
- If already on
- Commit
<secondary_branch>if there are local changes.- Stage relevant changes with
git addunless the user requested a narrower scope. - Generate a Conventional Commits message with an English
type(scope):prefix and a Chinese summary after the colon. - Do not use
--no-verify. - If hooks or checks fail, fix the issue before committing.
- If
<secondary_branch>has no local changes, skip commit and continue to push.
- Stage relevant changes with
- Push
<secondary_branch>.- Run
git push origin <secondary_branch>. - If the push is rejected because the remote moved, fetch and inspect before retrying; do not force-push unless the user explicitly requested it.
- Run
- Merge into
<primary_branch>.- Run
git checkout <primary_branch>. - Run
git pull --ff-only origin <primary_branch>. - Run
git merge --no-ff <secondary_branch> -m "chore(<primary_branch>): merge <secondary_branch> into <primary_branch>"to preserve a merge commit when<primary_branch>does not already contain<secondary_branch>. - If there are merge conflicts, stop after Git reports them and tell the user which files need resolution.
- Run
- Push
<primary_branch>.- Run
git push origin <primary_branch>.
- Run
- Return to
<secondary_branch>.- Run
git checkout <secondary_branch>. - Verify with
git status --shortandgit branch --show-current. - The final branch must be
<secondary_branch>. - Report the secondary branch commit SHA, the primary branch merge commit SHA when one was created, the pushed branches, and the final branch.
- Run
Reporting
Keep the final response concise. Include successful branch pushes and commit hashes. If the host app supports Git directives, emit them only after the matching Git action succeeds.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

