From 592a4c699bbcc6bde414ef8fdcadd451710b84c3 Mon Sep 17 00:00:00 2001 From: Vivian Richter Date: Sun, 11 Oct 2026 12:16:49 +0200 Subject: [PATCH] docs(rebase-current-branch): update rebase workflow guidance Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- skills/rebase-current-branch/SKILL.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/skills/rebase-current-branch/SKILL.md b/skills/rebase-current-branch/SKILL.md index a5f85dd2c..571905342 100644 --- a/skills/rebase-current-branch/SKILL.md +++ b/skills/rebase-current-branch/SKILL.md @@ -2,7 +2,7 @@ name: rebase-current-branch description: 'Rebase the currently checked out feature branch onto the latest upstream default branch. Use when asked to update a branch with main or master, rebase the current branch onto the default branch, or sync a feature branch before review. Detects whether the repository uses main or master and guides safe conflict handling.' license: MIT -allowed-tools: Bash(git status:*) Bash(git branch:*) Bash(git remote:*) Bash(git fetch:*) Bash(git rebase:*) Bash(git rev-parse:*) Bash(git show-ref:*) +allowed-tools: Bash --- # Rebase the Current Branch @@ -11,7 +11,7 @@ Update the active branch by replaying its commits on top of the latest default b ## Workflow -1. **Inspect before changing anything.** Run `git status --short --branch` and `git branch --show-current`. Confirm the current branch is not the default branch and note any local changes. If the working tree has changes, stop and ask the user whether to commit, stash, or otherwise handle them. Do not stash automatically. +1. **Inspect before changing anything.** Run `git status --porcelain=v1 --branch --untracked-files=all` and `git branch --show-current`. Prefer porcelain output so scripting and status parsing are reliable and the state is easy to inspect. Confirm the current branch is not the default branch and note any local changes. If the working tree has changes, stop and ask the user whether to commit, stash, or otherwise handle them. Do not stash automatically. 2. **Identify the upstream and default branch.** Check `git remote -v` and `git remote show ` (or the remote's symbolic `HEAD`) to determine the branch this repository treats as its default. Prefer the configured upstream for the current branch when available; otherwise use `origin`. Do not assume that `main` exists or that a branch named `master` is current. If the default branch cannot be identified unambiguously, ask the user. 3. **Fetch the latest default branch.** Fetch only the identified remote and default branch, for example: @@ -27,7 +27,8 @@ Update the active branch by replaying its commits on top of the latest default b ``` 5. **Handle conflicts without discarding work.** If the rebase stops, explain which files conflict and that the rebase is paused. Resolve only when the intended changes are clear; otherwise ask the user. After resolution, stage the resolved files and run `git rebase --continue`. If the user wants to abandon the operation, run `git rebase --abort`. Never use `git reset --hard`, discard user changes, or skip commits to force completion. -6. **Verify the result.** When the rebase completes, run `git status --short --branch` and summarize the outcome, including the base branch used and any remaining changes. Do not push, force-push, or amend commits unless the user separately asks. +6. **Offer the user a hook-driven follow-up.** After the rebase succeeds, tell the user they may want to run project hooks (for example, linting or validation scripts) before preparing the next commit. This helps keep the workflow efficient by catching issues early and reducing churn when the branch is ready for review or commit. +7. **Verify the result.** When the rebase completes, run `git status --porcelain=v1 --branch --untracked-files=all` and summarize the outcome, including the base branch used and any remaining changes. Do not push, force-push, or amend commits unless the user separately asks. ## Quick Path