Skip to content

Add merge worktree branch and delete feature - #3

Merged
melonamin merged 1 commit into
mainfrom
feature/merge-and-delete
Jan 14, 2026
Merged

melonamin merged 1 commit into
mainfrom
feature/merge-and-delete

Conversation

@melonamin

Copy link
Copy Markdown
Owner

Summary

Implements the feature requested in #2 - the ability to merge a worktree's branch into the default branch and delete both the worktree and branch in one operation.

  • TUI: Press m on any worktree to start the merge flow, select strategy (s for squash, f for fast-forward)
  • CLI: gt --merge <branch> with optional --squash or --ff-only flags
  • Config: New default_merge_strategy option ("squash" or "ff-only")

Pre-flight checks

The operation is blocked if:

  • Worktree has uncommitted changes
  • Branch is behind the default branch (for ff-only)
  • Branch has no new commits to merge
  • Worktree is currently checked out
  • Target is the default branch itself

Workflow

  1. Remove worktree (so branch is not checked out)
  2. Checkout default branch
  3. Perform merge (squash or ff-only)
  4. Delete branch (-D for squash, -d for ff-only)

Closes #2

Test plan

  • TUI: Select a worktree with commits ahead, press m, select strategy, confirm
  • TUI: Verify blocked when worktree has uncommitted changes
  • TUI: Verify blocked when selecting current worktree
  • CLI: gt --merge <branch> performs ff-only merge
  • CLI: gt --merge <branch> --squash performs squash merge
  • CLI: Error message when branch not found
  • Verify branch and worktree are deleted after successful merge

Implements the ability to merge a worktree's branch into the default
branch (main/master) and delete both the worktree and branch in one
operation.

Features:
- TUI: Press 'm' to merge selected worktree, choose strategy (squash/ff-only)
- CLI: gt --merge <branch> [--squash|--ff-only]
- Config: default_merge_strategy option in config.json
- Pre-flight checks: uncommitted changes, ahead/behind status, ff-possible
- Blocks merge if: current worktree, no commits ahead, behind default (ff-only)

Closes #2
@melonamin

Copy link
Copy Markdown
Owner Author

gt-macos-universal.zip

@melonamin
melonamin merged commit d2b69ad into main Jan 14, 2026
@melonamin
melonamin deleted the feature/merge-and-delete branch January 14, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merge (squash/ff-only) & delete workflow

1 participant