Loading...
Loading...
This skill should be used when the user asks to "complete a branch", "merge to main", "finish my feature", "ship this branch", "integrate to main", "create a PR from GitButler", or when `--complete-branch` flag is mentioned. Guides completion of GitButler virtual branches with safety snapshots, integration workflows, and cleanup.
npx skill4agent add outfitter-dev/agents gitbutler-complete-branchbut oplog snapshotbut push <branch>but pr new <branch>but branch delete <branch>but oplog snapshotgit checkout maingit pullgit merge --no-ff refs/gitbutler/<branch>git pushbut branch delete <branch>git checkout gitbutler/workspacegit push origin refs/gitbutler/<branch>:refs/heads/<branch>gh pr create| Check | Command | Expected |
|---|---|---|
| GitButler running | | Version output |
| Work committed | | Committed changes, no unassigned files |
| Tests passing | | All green |
| Base updated | | Up to date with main |
| Snapshot created | | Snapshot ID returned |
# 1. Verify branch state
but status
but show feature-auth
# 2. Create snapshot
but oplog snapshot --message "Before publishing feature-auth"
# 3. Authenticate with forge (one-time)
but config forge auth
# 4. Push branch and create PR
but push feature-auth
but pr new feature-auth
# 5. Review and merge PR on GitHub
# 6. Update local and clean up
but pull
but branch delete feature-auth# 1. Verify branch state
but status
but show feature-auth
# 2. Create snapshot
but oplog snapshot --message "Before integrating feature-auth"
# 3. Switch to main
git checkout main
# 4. Update main
git pull origin main
# 5. Merge with --no-ff (preserves history)
git merge --no-ff refs/gitbutler/feature-auth -m "feat: add user authentication"
# 6. Push
git push origin main
# 7. Clean up
but branch delete feature-auth
git checkout gitbutler/workspace# 1. Push branch to remote
git push origin refs/gitbutler/feature-auth:refs/heads/feature-auth
# 2. Create PR
gh pr create --base main --head feature-auth \
--title "feat: add user authentication" \
--body "Description..."
# 3. Wait for review and approval
# 4. Merge PR (via GitHub UI or CLI)
gh pr merge feature-auth --squash
# 5. Update main and clean up
git checkout main
git pull origin main
but branch delete feature-auth
git checkout gitbutler/workspace# Must merge in order: base → dependent → final
# 1. Merge base branch first
git checkout main && git pull
git merge --no-ff refs/gitbutler/feature-base -m "feat: base feature"
git push origin main
but branch delete feature-base
git checkout gitbutler/workspace
# 2. Update remaining branches
but pull
# 3. Merge next level
git checkout main && git pull
git merge --no-ff refs/gitbutler/feature-api -m "feat: API feature"
git push origin main
but branch delete feature-api
git checkout gitbutler/workspace
# 4. Repeat for remaining stack levelsFor comprehensive stacked branch management, load the gitbutler-stacks skill.
# View conflicted files
git status
# Resolve conflicts manually
# Stage resolved files
git add src/auth.ts
# Complete merge
git commit
# Verify and push
git push origin main
# Clean up
but branch delete feature-auth
git checkout gitbutler/workspacegit pull origin main
# Resolve any conflicts if main diverged
git push origin maingit reset --hard HEAD~1
git checkout gitbutler/workspacegit revert -m 1 HEAD
git push origin main# Delete integrated virtual branch
but branch delete feature-auth
# Clean up remote branch (if created for PR)
git push origin --delete feature-auth
# Verify workspace is clean
but status # Should show remaining active branches only
but status # Branch should be gonebut oplog snapshot --message "..."--no-ffgit checkout gitbutler/workspacegit pullgitbutler/workspace| Symptom | Cause | Solution |
|---|---|---|
| Merge conflicts | Diverged from main | Resolve conflicts, stage, commit |
| Push rejected | Main moved ahead | |
| Branch not found | Wrong ref path | Use |
| Can't return to workspace | Integration branch issue | |
# If integration went wrong
but oplog
but undo # Restores pre-integration state
# If stuck after git operations
git checkout gitbutler/workspacebut pull# Good: Describes what and why
git merge --no-ff feature-auth -m "feat: add JWT-based user authentication"
# Bad: Generic message
git merge --no-ff feature-auth -m "Merge branch"