git-operations
使用 GitHub MCP + git 创建私有仓库、通过 git switch 同步主分支、安全分支、无触碰主分支推送和打开 PRs 的工作流程。用于需要 Git 分支/发布指导的任何任务。
📖 中文导读:使用 GitHub MCP + git 创建私有仓库、通过 git switch 同步主分支、安全分支、无触碰主分支推送和打开 PRs 的工作流程。用于需要 Git 分支/发布指导的任何任务。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: git-operations description: >- Workflow for using GitHub MCP + git to create private repos, sync main via git switch, branch safely, push without touching main, and open PRs. Use for any task that needs Git branching/publishing guidance.
Git Operations Skill
Use this skill to standardize operations with GitHub MCP and local git. All required
steps are documented here.
Prerequisites
- You can call GitHub MCP
create_repository(PAT configured). git switchis available locally (usegit checkouton older Git).- Never push directly to
main. Always use acodex/<task>branch.
Flow Overview
- Create a repository (if needed)
- Use GitHub MCP
create_repository/github__create_repositoryand always setprivate: true:{ "name": "project-name", "description": "...", "private": true } - After creation, run
git remote add origin <repo-url>locally. Public repos are not allowed.
- Use GitHub MCP
- Sync main
git fetch origin git switch main # use checkout on older Git git status # ensure clean git pull --ff-only origin main - Branch handling
- If an existing branch is not merged, continue with
git switch <branch>and edit there. - If merged into main, create a new branch with
git switch -c codex/<task-name>(e.g.codex/git-ops-skill). Usegit checkout -b ...on older Git.
- If an existing branch is not merged, continue with
- Edit and sync
git add <files> git commit -m "type: summary" git fetch origin git rebase origin/main # or git merge origin/main - Push & PR
git push -u origin codex/<task>- Do not push to
main. Create the PR via GitHub MCPcreate_pull_requestand include purpose/changes/tests.
- Do not push to
- After completion
git switch main git pull --ff-only origin main git branch -d codex/<task>
Checklist
- Repository is private
- main is up to date at start
- Branch name follows
codex/<task> - Push is only from the working branch (
mainforbidden) - PR link is shared in Slack
Additional Notes
- If rebase is difficult,
git merge origin/mainis acceptable, but resolve conflicts locally before pushing. - Use
git push --force-with-leaseonly after rebase and with reviewer agreement.