Navigate to branches in the machete stack
Navigates between branches in a git-machete stack using directional commands.
/plugin marketplace add settlemint/agent-marketplace/plugin install crew@settlemint[up | down | next | prev | root | first | last]git/stacked/<butler_context>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/gitbutler-context.sh
</butler_context>
<worktree_status>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/worktree-context.sh 2>&1
</worktree_status>
<stack_context>
!${CLAUDE_PLUGIN_ROOT}/scripts/git/machete-context.sh 2>&1
</stack_context>
<gitbutler_incompatible>
This command does not work with GitButler.
If GITBUTLER_ACTIVE=true from <butler_context>:
Stacked branches (git-machete) are not compatible with GitButler virtual branches.
GitButler has its own stacking system. Use these instead:
- `crew:git:butler:status` - View virtual branches
- `crew:git:butler:branch` - Create virtual branch
- `crew:git:butler:sync` - Sync with upstream
To use machete, first disable GitButler in this repository.
Exit immediately. Do not proceed with machete commands.
</gitbutler_incompatible>
<objective>Navigate between branches in the machete stack using directional commands.
</objective> <directions>| Direction | Target |
|---|---|
up | Parent branch |
down | First child branch |
next | Next sibling (same level) |
prev | Previous sibling |
root | Root of current branch tree |
first | First branch in layout |
last | Last branch in layout |
If no argument provided:
AskUserQuestion({
questions: [
{
question: "Which direction to navigate?",
header: "Navigate",
options: [
{ label: "Up", description: "Go to parent branch" },
{ label: "Down", description: "Go to first child branch" },
{ label: "Next", description: "Go to next sibling" },
{ label: "Prev", description: "Go to previous sibling" },
],
multiSelect: false,
},
],
});
direction="${1:-up}"
target=$(git machete show "$direction" 2>/dev/null || echo "")
if [[ -z "$target" ]]; then
echo "No branch in direction '$direction'"
git machete status
exit 1
fi
echo "Will checkout: $target"
if ! git diff --quiet || ! git diff --cached --quiet; then
echo "Uncommitted changes:"
git status --short
fi
If uncommitted changes:
AskUserQuestion({
questions: [
{
question: "You have uncommitted changes. What to do?",
header: "Changes",
options: [
{ label: "Stash", description: "Stash changes and switch" },
{ label: "Commit", description: "Commit changes first" },
{ label: "Cancel", description: "Stay on current branch" },
],
multiSelect: false,
},
],
});
If "Stash": git stash push -m "Auto-stash before go $direction"
If "Commit": Skill({ skill: "crew:git:commit" })
git machete go "$direction"
echo "=== Now on: $(git branch --show-current) ==="
git machete status
</workflow>
<success_criteria>
</success_criteria>
/goWORKFLOW COMMAND - Execute TodoWrite FIRST, then Preflight → Phase 1 → 2 → 3. Do NOT read ~/.claude/plans/ until after TodoWrite.