Phase 1b: Rename all ~94 commands across 12 plugins to /<noun> <action> sub-command pattern. Git-flow consolidated from 8→5 commands (commit variants absorbed into --push/--merge/--sync flags). Dispatch files, name: frontmatter, and cross-reference updates for all plugins. Phase 2: Design documents for 8 new plugins in docs/designs/. Phase 3: Scaffold 8 new plugins — saas-api-platform, saas-db-migrate, saas-react-platform, saas-test-pilot, data-seed, ops-release-manager, ops-deploy-pipeline, debug-mcp. Each with plugin.json, commands, agents, skills, README, and claude-md-integration. Marketplace grows from 12→20. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
147 lines
2.3 KiB
Markdown
147 lines
2.3 KiB
Markdown
# Sync Workflow
|
|
|
|
## Purpose
|
|
|
|
Defines push/pull patterns, rebase strategies, upstream tracking, and stale branch detection.
|
|
|
|
## When to Use
|
|
|
|
- Pushing commits in `/gitflow commit --push`
|
|
- Full sync operations in `/gitflow commit --sync`
|
|
- Detecting and reporting stale branches
|
|
|
|
## Push Workflow
|
|
|
|
### First Push (No Upstream)
|
|
|
|
```bash
|
|
git push -u origin <branch>
|
|
```
|
|
|
|
Sets upstream tracking for future pushes.
|
|
|
|
### Subsequent Pushes
|
|
|
|
```bash
|
|
git push
|
|
```
|
|
|
|
Pushes to tracked upstream.
|
|
|
|
### Push After Rebase
|
|
|
|
```bash
|
|
git push --force-with-lease
|
|
```
|
|
|
|
Safe force push - fails if remote has new commits.
|
|
|
|
## Sync with Base Branch
|
|
|
|
```bash
|
|
# 1. Fetch all with prune
|
|
git fetch --all --prune
|
|
|
|
# 2. Rebase on base branch
|
|
git rebase origin/<base-branch>
|
|
|
|
# 3. Push (force if rebased)
|
|
git push --force-with-lease
|
|
```
|
|
|
|
## Push Conflict Handling
|
|
|
|
When push fails due to diverged history:
|
|
|
|
```
|
|
Remote has changes not in your local branch.
|
|
|
|
Options:
|
|
1. Pull and rebase, then push (Recommended)
|
|
2. Pull and merge, then push
|
|
3. Force push (destructive - requires confirmation)
|
|
4. Cancel and review manually
|
|
```
|
|
|
|
### Rebase Resolution
|
|
|
|
```bash
|
|
git pull --rebase origin <branch>
|
|
git push
|
|
```
|
|
|
|
### Merge Resolution
|
|
|
|
```bash
|
|
git pull origin <branch>
|
|
git push
|
|
```
|
|
|
|
## Stale Branch Detection
|
|
|
|
Find local branches tracking deleted remotes:
|
|
|
|
```bash
|
|
git branch -vv | grep ': gone]'
|
|
```
|
|
|
|
### Report Format
|
|
|
|
```
|
|
Stale local branches (remote deleted):
|
|
- feat/old-feature (was tracking origin/feat/old-feature)
|
|
- fix/merged-bugfix (was tracking origin/fix/merged-bugfix)
|
|
|
|
Run /gitflow branch-cleanup to remove these branches.
|
|
```
|
|
|
|
## Remote Pruning
|
|
|
|
Remove stale remote-tracking references:
|
|
|
|
```bash
|
|
git fetch --prune
|
|
```
|
|
|
|
Or fetch all remotes:
|
|
|
|
```bash
|
|
git fetch --all --prune
|
|
```
|
|
|
|
## Sync Status Report
|
|
|
|
```
|
|
Sync complete:
|
|
|
|
Local: feat/password-reset @ abc1234
|
|
Remote: origin/feat/password-reset @ abc1234
|
|
Base: development @ xyz7890 (synced)
|
|
|
|
Your branch is up-to-date with development.
|
|
No conflicts detected.
|
|
|
|
Cleanup:
|
|
Remote refs pruned: 2
|
|
Stale local branches: 2 (run /gitflow branch-cleanup to remove)
|
|
```
|
|
|
|
## Tracking Setup
|
|
|
|
Check tracking status:
|
|
|
|
```bash
|
|
git branch -vv
|
|
```
|
|
|
|
Set upstream:
|
|
|
|
```bash
|
|
git branch --set-upstream-to=origin/<branch> <branch>
|
|
```
|
|
|
|
## Related Skills
|
|
|
|
- skills/git-safety.md
|
|
- skills/merge-workflow.md
|