xiaohongshu
xiaohongshu
branch-integration-workflow
Safely review and merge remote branches into stable. Trigger when: (1) reviewing open PRs, (2) integrating feature branches, (3) checking for stale branches with potential conflicts.
Full skill instructions
| Item | Details |
|---|---|
| Date | 2024-12-31 |
| Goal | Safely review and integrate remote branches when gh CLI unavailable |
| Environment | Git repository with multiple remote feature branches |
| Status | Success |
Problem: Need to review and merge remote branches, but gh CLI may not be available. Must safely identify which branches can merge cleanly and which have conflicts.
Solution: Use git commands to analyze branches, test merges non-destructively, and integrate cleanly.
# Update local references to all remote branches
git fetch --all
# List all remote branches
git branch -r
Example output:
origin/claude/python-3.14-upgrade-analysis-fmdvv
origin/claude/update-training-v2.7.0-Zl9eH
origin/feature/v3.0-multi-agent
origin/release/v2.3.0
origin/stable
Check how far behind/ahead each branch is relative to stable:
# For each branch, check commits ahead/behind stable
for branch in origin/claude/python-3.14-upgrade-analysis-fmdvv origin/feature/v3.0-multi-agent; do
echo "=== $branch ==="
git log $branch --oneline -3
echo "Behind stable by:"
git rev-list --count $branch..stable
echo ""
done
| Branch | Behind Stable | Content Summary | Recommendation |
|---|---|---|---|
claude/python-3.14-* | 4 commits | Docs, CI updates | Merge |
claude/update-training-* | 4 commits | Tests, notebook | Merge |
feature/v3.0-* | 14 commits | Major feature | Review conflicts |
release/v2.3.0 | 105 commits | Old release | Delete |
CRITICAL: Always test merge before actually merging.
# Ensure clean working directory
git stash # if needed
# Create temporary test branch from stable
git checkout -b test-merge-branch stable
# Attempt merge without committing
git merge --no-commit --no-ff origin/branch-name
Possible outcomes:
# Check what would be merged
git diff --cached --stat
# Abort the test merge
git merge --abort
# Clean up test branch
git checkout stable
git branch -D test-merge-branch
# Restore stashed changes
git stash pop # if stashed earlier
Once confirmed clean:
# Merge with automatic commit message
git merge origin/branch-name --no-edit
# Or with custom message
git merge origin/branch-name -m "Merge branch-name: description"
# Always verify after merge
python -m pytest tests/ -v --tb=short
For branches that don't merge cleanly:
# Check specific conflicts
git checkout -b resolve-conflicts stable
git merge --no-commit origin/conflicting-branch
# See conflicted files
git status | grep "both modified"
# Example output:
# both modified: CLAUDE.md
# both modified: alpaca_trading/training/__init__.py
Options:
For branches significantly behind with no unique value:
# Delete local branch
git branch -D old-branch
# Delete remote branch (if authorized)
git push origin --delete old-branch
| Commits Behind | Merges Cleanly | Action |
|---|---|---|
| < 10 | Yes | Merge immediately |
| < 10 | No | Review conflicts, resolve if simple |
| 10-50 | Yes | Merge, verify tests carefully |
| 10-50 | No | Defer - significant conflict resolution needed |
| > 50 | Any | Likely obsolete - consider deleting |
| Attempt | Why it Failed | Lesson Learned |
|---|---|---|
| Merge without testing first | Conflicts discovered mid-merge, messy abort | Always test with --no-commit first |
| Merge multiple branches at once | Hard to identify which caused test failures | Merge one at a time, test between |
| Assume clean merge = safe | Tests can still fail after clean merge | Always run tests after merge |
| Force push to fix bad merge | Rewrites history, breaks collaborators | Never force push to shared branches |
| Skip stashing local changes | Test merge fails due to dirty working tree | Always start with clean working directory |
# List remote branches
git branch -r
# Check branch divergence
git rev-list --count stable..origin/branch # Commits in branch not in stable
git rev-list --count origin/branch..stable # Commits in stable not in branch
# Find common ancestor
git merge-base stable origin/branch
# See branch commit history
git log origin/branch --oneline -10
# Test merge (non-destructive)
git merge --no-commit --no-ff origin/branch
# See merge changes
git diff --cached --stat
# Abort test merge
git merge --abort
# Actual merge
git merge origin/branch --no-edit
# Delete remote branch
git push origin --delete branch-name
--no-commitgit diff --cached --stat--no-commit --no-ff is non-destructivepython-3.14-upgrade and update-training-v2.7.0 branchesxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience