mpt-ext-tool-git-branch-ops
Skill3 starsChanged 4 months agoApache-2.0View on GitHub
When a task needs a low-level Git branch operation for an already-decided branch name — create or switch safely on the correct base. Used by branch tasks, not for deriving names from Jira.
In this repository34 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/mpt-extension-skills.mdcCursor rule
- mpt-ext-task-apply-dashboard-jira-decisionSkill
- mpt-ext-task-commit-changesSkill
- mpt-ext-task-create-initial-epicSkill
- mpt-ext-task-create-work-branchSkill
- mpt-ext-task-dependabot-pr-policy-fixSkill
- mpt-ext-task-ensure-active-sprintSkill
- mpt-ext-task-fix-pre-commit-failuresSkill
- mpt-ext-task-fix-repository-check-failuresSkill
- mpt-ext-task-handle-pr-commentsSkill
- mpt-ext-task-move-jira-to-code-reviewSkill
- mpt-ext-task-move-jira-to-qaSkill
- mpt-ext-task-notify-pr-ready-in-teamsSkill
- mpt-ext-task-open-pull-requestSkill
- mpt-ext-task-run-repository-checksSkill
- mpt-ext-task-start-jira-workSkill
- mpt-ext-task-update-docs-from-changesSkill
- mpt-ext-task-write-documentationSkill
- mpt-ext-task-write-python-unittestsSkill
- mpt-ext-tool-gh-pr-opsSkill
- mpt-ext-tool-jira-workitem-opsSkill
- mpt-ext-tool-teams-send-messageSkill
- mpt-ext-workflow-address-review-feedbackSkill
- mpt-ext-workflow-complete-after-mergeSkill
- mpt-ext-workflow-dashboard-failure-triageSkill
- mpt-ext-workflow-decompose-tdrSkill
- mpt-ext-workflow-fix-dependabot-prsSkill
- mpt-ext-workflow-hotfix-backportSkill
- mpt-ext-workflow-notify-pr-readySkill
- mpt-ext-workflow-send-to-reviewSkill
- mpt-ext-workflow-skill-authoringSkill
- mpt-ext-workflow-start-workSkill
- mpt-ext-workflow-update-documentationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. About 0 are common, 16 are distinctive, and 2 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 52
Read repository-specific docs when they exist, because they may extend or override shared guidance.
- Very specific: line 53
Read shared docs only when the repository explicitly points to them.
- Distinctive: line 57
Use the bundled deterministic script to resolve the base branch:
- Very specific: line 67
If the script reports that no remote release/* branch exists for hotfix or backport, stop and report the blocker.
- Distinctive: line 70
Check the current branch and worktree status.
- Distinctive: line 71
If the worktree is dirty, stop and ask the user whether to continue.
- Distinctive: line 72
Check whether the target branch already exists locally or remotely.
- Distinctive: line 73
If the target branch already exists, stop and ask the user what to do.
- Distinctive: line 75
Update the base branch locally.
- Distinctive: line 83
Create and switch to the target branch.
- Distinctive: line 84
Create the new branch from the updated local base branch:
- Distinctive: line 93
If blocked, report the exact blocker: dirty worktree, branch naming conflict, or missing release branch.
- Distinctive: line 118
Never continue past a dirty worktree without explicit user confirmation.
- Distinctive: line 119
Never hand-select the base branch when the bundled script can resolve it.
- Distinctive: line 120
Never silently reuse an existing local or remote branch with the same name.
- Distinctive: line 121
Never invent a release branch when none exists.
- Distinctive: line 122
Never rewrite history or delete branches as part of this skill.
- Distinctive: line 123
Never generate business-specific branch names from Jira content inside this tool skill.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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 Branch Ops
Purpose
Perform Git branch operations safely and consistently when starting work.
Use When
- The user wants to create a new work branch.
- The user wants to start a feature, bugfix, hotfix, or backport branch.
- The task requires selecting the correct base branch from the branch type.
- The task requires checking for dirty worktrees or branch naming conflicts before branch creation.
Do Not Use When
- The task is to read or update Jira issues.
- The task is to generate a branch name from Jira title or description.
- The task is to open or update a pull request.
- The task is to perform destructive Git history operations such as reset, rewrite, or force-delete.
Inputs
branch_typefeaturebugfixhotfixbackport
target_branch_name- Optional
remote_name- default:
origin
- default:
- Installed shared package root when shared package guidance is needed:
${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/currentAssumptions
- The command is running inside the target Git repository and local Git tooling is available.
- Remote access and Git credentials are configured well enough to read and update the selected base branch.
- The current repository state is suitable for branch creation, or the user is available to decide how to proceed when the worktree is dirty or a branch conflict is detected.
Workflow
- Build repository context first.
- Read the target repository
AGENTS.mdonce per session. If you already loaded it earlier in this session and still have its full contents, reuse them instead of re-reading; if the context was summarized or you are unsure it is complete, read it again. Do not pre-load shared docs in this step; read them lazily only when the repository points to them. - Read repository-specific docs when they exist, because they may extend or override shared guidance.
- Read shared docs only when the repository explicitly points to them. Resolve those shared docs from
${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/currentwhen available; otherwise read them from themainbranch of the shared GitHub repository.
- Resolve the base branch from the branch type.
- For repositories that follow this package standard, read
standards/branching.mdusing the shared-doc resolution rule from the repository context step, and use it as the source of truth for base-branch selection, hotfix/backport handling, and push conventions. - Use the bundled deterministic script to resolve the base branch:
python3 "${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-tool-git-branch-ops/scripts/resolve_base_branch.py" \
--branch-type feature \
--remote-name origin- For
featureandbugfix, the script returnsmain. - For
hotfixandbackport, the script returns the latest remoterelease/*branch by numeric suffix. - If the script reports that no remote
release/*branch exists forhotfixorbackport, stop and report the blocker.
- Inspect the current Git state.
- Check the current branch and worktree status.
- If the worktree is dirty, stop and ask the user whether to continue.
- Check whether the target branch already exists locally or remotely.
- If the target branch already exists, stop and ask the user what to do.
- Update the base branch locally.
- Switch to the resolved base branch.
- Update it with:
git pull <remote_name> <base-branch>- Create and switch to the target branch.
- Create the new branch from the updated local base branch:
git checkout -b <target_branch_name>- Report the result clearly.
- State which base branch was selected.
- State whether the branch was created successfully.
- If blocked, report the exact blocker: dirty worktree, branch naming conflict, or missing release branch.
Command Patterns
# Inspect repository state
git status --short --branch
git branch --list
git branch --remotes
# Resolve base branch
base_branch="$(python3 "${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-tool-git-branch-ops/scripts/resolve_base_branch.py" \
--branch-type <branch_type> \
--remote-name <remote_name>)"
# Switch to base branch and update it
git checkout "${base_branch}"
git pull <remote_name> "${base_branch}"
# Create target branch
git checkout -b feature/MPT-1234/example-short-descriptionGuardrails
- Never continue past a dirty worktree without explicit user confirmation.
- Never hand-select the base branch when the bundled script can resolve it.
- Never silently reuse an existing local or remote branch with the same name.
- Never invent a release branch when none exists.
- Never rewrite history or delete branches as part of this skill.
- Never generate business-specific branch names from Jira content inside this tool skill; accept the target branch name as input.
Bundled Resources
scripts/resolve_base_branch.py- Inputs: branch type and optional remote name
- Output: base branch name, or JSON with
base_branch - Runtime path:
${MPT_EXTENSION_SKILLS_HOME:-$HOME/.mpt-extension-skills}/current/skills/mpt-ext-tool-git-branch-ops/scripts/resolve_base_branch.py
Expected Outcome
The correct base branch is selected and updated, the target branch is created and checked out safely, or the operation stops with a clear blocker that requires user direction.
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.

