Guides rebase workflows for updating feature branches onto the current development branch (dev/develop). Activates when user mentions "rebase", "branch aktualisieren", "dev stand", "feature branch updaten", "merge conflicts", or "rebase MRs". Recommends /lt-dev:git:rebase for single branches and /lt-dev:git:rebase-mrs for batch operations. NOT for merge request descriptions (use git:mr-description). NOT for general git operations (use git commands directly).
Install
npx skillscat add lennetech/claude-code/rebasing-branches Install via the SkillsCat registry.
Rebase Workflow Knowledge Base
This skill provides knowledge and strategy for rebasing feature branches onto a development branch. For automated execution, use the lt-dev:branch-rebaser agent via /lt-dev:git:rebase or /lt-dev:git:rebase-mrs.
When This Skill Activates
- Rebasing feature branches onto dev/develop
- Resolving merge conflicts during rebase
- Batch-rebasing multiple MRs/PRs
- Updating a branch to include latest dev changes
- Planning rebase strategies for multiple branches
Skill Boundaries
| User Intent | Correct Skill |
|---|---|
| "Rebase my branch onto dev" | THIS SKILL |
| "Rebase all open MRs" | THIS SKILL |
| "Branch aktualisieren" | THIS SKILL |
| "Merge conflicts lösen" | THIS SKILL |
| "Create MR description" | git:mr-description |
| "Generate commit message" | git:commit-message |
| "Update nest-server" | nest-server-updating |
| "npm audit fix" | maintaining-npm-packages |
Related Skills
| Element | Purpose |
|---|---|
Agent: lt-dev:branch-rebaser |
Autonomous rebase execution |
Command: /lt-dev:git:rebase |
Single branch rebase |
Command: /lt-dev:git:rebase-mrs |
Batch rebase for MRs/PRs |
Command: /lt-dev:review |
Code review after rebase |
Skill: generating-nest-servers |
Backend code patterns |
Skill: developing-lt-frontend |
Frontend code patterns |
Skill: coordinating-agent-teams |
Parallel worktree execution for batch rebase (>2 branches) |
Rebase Strategy
Single Branch Workflow
- Fetch latest from remote
- Rebase onto target branch (default:
dev) - Resolve conflicts using project context and Linear ticket info
- Optimize code based on new dev state (remove redundancies)
- Lint & format with oxfmt/oxlint
- Run tests to verify nothing broke
- Review changes for quality
Batch Workflow (MRs/PRs)
Same as single branch, plus:
- List open MRs/PRs from GitHub (
gh) or GitLab (glab) - User selects which branches to rebase
- After each branch: commit changes + force push with lease
- Generate summary report across all branches
Base Branch Detection
| Priority | Source | Method |
|---|---|---|
| 1 | User argument | --base=<branch> |
| 2 | Common convention | Check if dev or develop exists |
| 3 | Default branch | Use main or master |
# Detect base branch
git branch -r | grep -E 'origin/(dev|develop)$' | head -1 | sed 's|origin/||;s/^[[:space:]]*//'Linear Ticket Extraction
Branch names often contain Linear ticket IDs. Extract and load ticket context for better conflict resolution and code optimization.
Extraction Patterns
| Pattern | Example | Ticket ID |
|---|---|---|
feat/DEV-123-description |
feat/DEV-123-add-auth |
DEV-123 |
fix/DEV-456-description |
fix/DEV-456-login-bug |
DEV-456 |
DEV-789/description |
DEV-789/refactor-api |
DEV-789 |
feature/PROJ-42-desc |
feature/PROJ-42-users |
PROJ-42 |
# Extract ticket ID from branch name
git branch --show-current | grep -oE '[A-Z]+-[0-9]+'Using Ticket Context
Once extracted, load via mcp__plugin_lt-dev_linear__get_issue:
- Title & description: Understand the feature intent
- Acceptance criteria: Verify rebase didn't break requirements
- Comments: Additional context for conflict resolution
Conflict Resolution Strategy
Priority Order
- Incoming changes (dev) for infrastructure/config files
- Feature changes (current branch) for feature-specific code
- Linear ticket context to decide ambiguous conflicts
- Both changes when they affect different concerns
Common Conflict Patterns
| File Type | Strategy |
|---|---|
package.json |
Accept dev versions, keep feature-specific additions |
*.lock files |
Regenerate after resolving package.json |
| Config files | Merge both, prefer dev for shared settings |
| Model/DTO files | Keep both changes, resolve type conflicts |
| Test files | Keep both tests, fix import conflicts |
| Migration files | Keep both, verify execution order |
After Conflict Resolution
# Continue rebase after resolving conflicts
git add .
git rebase --continue
# If rebase becomes unrecoverable
git rebase --abortPost-Rebase Optimization
After successful rebase, check if new dev code makes parts of the feature branch redundant:
- Duplicate implementations: Feature branch added something that dev now provides
- Outdated workarounds: Feature branch worked around a bug that dev fixed
- API changes: Feature branch uses old patterns that dev updated
- Dependency conflicts: Feature branch pins a version that dev updated
Lint & Format Tools
oxfmt (Formatter)
# Format all files in a project
npx oxfmt .
# Format specific files
npx oxfmt src/path/to/file.tsoxlint (Linter)
# Lint all files
npx oxlint .
# Lint with auto-fix
npx oxlint --fix .Force Push Safety
Always use --force-with-lease instead of --force:
git push --force-with-leaseThis prevents overwriting changes that someone else pushed to the same branch after your last fetch.
When to Use Commands
| Scenario | Command |
|---|---|
| Rebase current branch onto dev | /lt-dev:git:rebase |
| Rebase with specific base branch | /lt-dev:git:rebase --base=main |
| Rebase all open MRs for a project | /lt-dev:git:rebase-mrs |
| Rebase selected MRs/PRs | /lt-dev:git:rebase-mrs [project-url] |