一键导入
git-ops
Branch management, rebase, merge, conflict resolution, and recovery procedures. Use for complex git operations during implementation or orchestration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Branch management, rebase, merge, conflict resolution, and recovery procedures. Use for complex git operations during implementation or orchestration.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Read and write architectural decisions to the shared memo-cli knowledge base. Use when recording or restoring cross-session context.
Break a technical specification into user stories with coverage validation. Use after generate-spec.
Establish product-context.md and technical-guidelines.md foundation docs. Use in product-engineer Init Mode.
Publish user stories as GitHub Issues following github-ops conventions. Use after generate-stories.
Clarify scope: produce a lightweight issue refinement or a full PRD. Use in product-engineer Feature or Issue Mode.
Execute a task list step-by-step with strict sequencing, branch/PR discipline, GitHub Issue sync, and user approval gates. Single source of truth for implementation. Use when implementing from a tasks-*.md file.
| name | git-ops |
| description | Branch management, rebase, merge, conflict resolution, and recovery procedures. Use for complex git operations during implementation or orchestration. |
Reusable procedures for git branch management, merge, rebase, and conflict resolution. This skill describes procedures — merge authority policies remain in github-ops.agent.md. Any agent can invoke this skill when encountering git operations.
# Fetch latest remote state
git fetch origin
# Switch to the default branch and pull
git checkout main
git pull origin main
# Create and switch to the new branch
git checkout -b <branch-name>
Naming conventions (defer to github-ops for policy):
story/<story-id>-<short-description>issue/<issue-number>-<short-description>integrate/<milestone-or-prd-name>When working under a planner orchestration with an integration branch:
git fetch origin
git checkout <integration-branch>
git pull origin <integration-branch>
git checkout -b <story-branch>
Preferred method to keep a branch up-to-date with its target:
git fetch origin
git rebase origin/<target-branch>
If conflicts occur → jump to Resolve Merge Conflicts.
If rebase is too complex (many commits, repeated conflicts), fall back to merge:
git fetch origin
git merge origin/<target-branch>
Before merging any PR or branch, verify:
git fetch origin
git log --oneline origin/<target-branch>..HEAD # should show only your commits
git merge-tree $(git merge-base HEAD origin/<target-branch>) HEAD origin/<target-branch>
# Run project-specific test command
gh CLI):
gh pr checks <pr-number>
Choose the appropriate strategy based on context:
| Strategy | When to Use | Command |
|---|---|---|
| Squash merge | Story/issue PRs → integration or main branch. Produces clean single-commit history. | gh pr merge <pr> --squash |
| Merge commit | Integration branch → main. Preserves the full story history. | gh pr merge <pr> --merge |
| Rebase merge | Small PRs with clean linear history. Avoid for multi-commit stories. | gh pr merge <pr> --rebase |
Default: Squash merge for story PRs, merge commit for integration PRs to main.
When a rebase or merge produces conflicts:
git diff --name-only --diff-filter=U
<<<<<<<, =======, >>>>>>>)# After resolving each file
git add <resolved-file>
# Continue the rebase or complete the merge
git rebase --continue # if rebasing
git commit # if merging
# Ensure no remaining conflict markers in the codebase
grep -rn '<<<<<<<\|=======\|>>>>>>>' --include='*.ts' --include='*.tsx' --include='*.js' --include='*.json' --include='*.md' .
# Run tests to verify the resolution is correct
If a rebase goes wrong or produces unexpected results:
# Abort the in-progress rebase
git rebase --abort
# Verify you're back to the pre-rebase state
git log --oneline -5
git status
If you already completed a bad rebase:
# Find the pre-rebase commit using reflog
git reflog
# Reset to the state before the rebase
git reset --hard <pre-rebase-sha>
Always report what happened to the user before and after recovery.
# Abort an in-progress merge
git merge --abort
# Verify clean state
git status
If a merge was already committed but is wrong:
# Revert the merge commit (keeps history clean)
git revert -m 1 <merge-commit-sha>
Force pushing MUST only be used on branches owned exclusively by the current agent/developer. Never force push shared branches.
# Safe force push (fails if someone else pushed)
git push --force-with-lease origin <branch-name>
Never use git push --force without --with-lease.
When resolving conflicts automatically, apply these heuristics in order:
| Agent | Typical Usage |
|---|---|
developer | Branch creation, rebase before PR, conflict resolution during implementation |
planner | Integration branch management, merging story PRs, rebasing integration onto main |
github-ops | PR merge execution (policy enforcement stays with github-ops, procedures come from this skill) |