3.3 KiB
3.3 KiB
| description | alwaysApply |
|---|---|
| When a Jira story is finished (merged or abandoned locally), return to main, pull, delete the local story branch | true |
Story end (Jira)
When the user ends story work on a ticketed branch—phrases like “end story”, “story is merged”, “clean up branch after NEON-…”, or they confirm the PR is merged to main—run this git sequence so local state matches the remote default branch.
1. Preconditions
- Merged: Prefer deleting the local branch only after
mainon the remote includes the story (PR merged). If the PR is not merged,git branch -dwill refuse; usegit branch -Donly when the user explicitly wants to drop unmerged work. - Uncommitted changes: Stash, commit, or discard before switching branches; do not leave a dirty tree without the user’s choice.
2. Steps (run in order)
git checkout maingit pull origin main(orgit pullifmainalready tracksorigin/mainand that is correct for this repo)git branch -d <story-branch>— use the branch that was used for the issue (first path segment should be the Jira key, e.g.NEON-7-move-validation). If Git reports “not fully merged”, confirm whetherorigin/mainalready contains the story (e.g. squash merge or follow-up commits only cherry-picked tomain). If yes,git branch -D <story-branch>is OK only with user confirmation so local unpushed tip is not lost by mistake.
2a. When main is push-protected
If the user asks to push changes that sit on main and git push origin main fails (required PR / status checks), create a branch from current main (e.g. chore/…), git push -u origin that branch, give them the PR link, then git reset --hard origin/main if you had temporarily advanced local main so local main matches remote until the PR merges.
3. What not to do
- Do not delete
mainororigin/*. - Do not assume the remote story branch should be deleted unless the user asks (many teams keep
origin/NEON-…for history or delete via GitHub UI).
4. Jira transition
- Do not call Jira transition APIs (e.g. Atlassian MCP
transitionJiraIssue) until the user has explicitly chosen the next status. Typical options here areIn TestorDone; usegetTransitionsForJiraIssueif names differ. - If the user only says “end story” / “merge cleanup” / similar without naming a target status: run the git steps in §2, then ask “In Test or Done?” and wait for their answer before transitioning. Never assume Done (or any status) without that confirmation.
- Exception: If the same user message already names the status (e.g. “end story, move NEON-28 to Done”), you may transition after git cleanup without a second ask.
- Perform the transition with Atlassian MCP when available (MCP server id
plugin-atlassian-atlassian, notatlassian). - If MCP is unavailable or the transition fails, tell the user and ask them to update the board manually.
Related
- story-kickoff — start of story workflow
- git-workflow — branch vs
main - jira-git-naming — branch names
- commit-and-review — push only when the user requests it