36 lines
1.9 KiB
Markdown
36 lines
1.9 KiB
Markdown
---
|
||
description: When a Jira story is finished (merged or abandoned locally), return to main, pull, delete the local story branch
|
||
alwaysApply: 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 NS-…”, 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 **`main`** on the remote includes the story (PR merged). If the PR is **not** merged, `git branch -d` will refuse; use **`git branch -D`** only 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)
|
||
|
||
1. **`git checkout main`**
|
||
2. **`git pull origin main`** (or `git pull` if `main` already tracks `origin/main` and that is correct for this repo)
|
||
3. **`git branch -d <story-branch>`** — use the branch that was used for the issue (first path segment should be the Jira key, e.g. `NS-19-move-validation`). If Git reports “not fully merged”, **stop** and tell the user; do not `-D` unless they ask.
|
||
|
||
## 3. What not to do
|
||
|
||
- Do **not** delete **`main`** or **`origin/*`**.
|
||
- Do **not** assume the remote story branch should be deleted unless the user asks (many teams keep `origin/NS-…` for history or delete via GitHub UI).
|
||
|
||
## 4. Jira (optional)
|
||
|
||
- If the issue should move to **Done** (or equivalent), use Atlassian MCP when available; otherwise the user updates the board. This rule does **not** require Jira transitions.
|
||
|
||
## Related
|
||
|
||
- [story-kickoff](story-kickoff.md) — start of story workflow
|
||
- [git-workflow](git-workflow.md) — branch vs `main`
|
||
- [jira-git-naming](jira-git-naming.md) — branch names
|
||
- [commit-and-review](commit-and-review.md) — push only when the user requests it
|