{
 "schema_version": 1,
 "generated": "2026-11-09",
 "id": "max-sixty-worktrunk--merge-a-worktree-and-clean-up",
 "repo": "max-sixty/worktrunk",
 "repo_url": "https://github.com/max-sixty/worktrunk",
 "repo_slug": "max-sixty-worktrunk",
 "title": "Merge a finished worktree back to main in one command",
 "page_title": "How to merge a finished worktree back to main in one command with Worktrunk",
 "summary": "Squash, rebase, fast-forward merge and remove the worktree with wt merge.",
 "who": "A developer finishing an agent's branch who wants it merged and cleaned up without several git commands.",
 "problem": "Finishing a worktree by hand means commit, rebase, merge, then remove the worktree and branch.",
 "outcome": "The change merged to main with a generated commit message and the worktree removed.",
 "steps": [
  "Run `wt merge main` from the worktree",
  "It generates a commit message, merges the commit to main and removes the worktree and branch in the background",
  "For a PR workflow instead run `wt step commit`, then `gh pr create`",
  "After the PR is merged run `wt remove`"
 ],
 "agent_prompt": "In the worktree for <branch>, run `wt merge main` and show me the output. If I prefer a PR, use `wt step commit`, `gh pr create` and later `wt remove`.",
 "agents": [
  "claude-code",
  "codex"
 ],
 "difficulty": "Beginner",
 "time": "10 minutes",
 "basis": "readme",
 "caveat": "Commit message generation relies on a configured LLM; see the LLM commit messages docs.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "rust",
 "requirements": [
  "git",
  "Homebrew or Cargo to install",
  "Shell integration via `wt config shell install` so commands can change directories",
  "An agent such as Claude Code or Codex"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.9,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/max-sixty-worktrunk/merge-a-worktree-and-clean-up/",
 "md": "https://dedupedai.com/use-cases/max-sixty-worktrunk/merge-a-worktree-and-clean-up/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/max-sixty-worktrunk--merge-a-worktree-and-clean-up.json",
 "api_version": "v1"
}
