Skip to content

feat(desktop): add bulk git operations to changes sidebar#802

Merged
Kitenite merged 9 commits intomainfrom
discard-all-on-staged
Jan 18, 2026
Merged

feat(desktop): add bulk git operations to changes sidebar#802
Kitenite merged 9 commits intomainfrom
discard-all-on-staged

Conversation

@Kitenite
Copy link
Copy Markdown
Collaborator

@Kitenite Kitenite commented Jan 18, 2026

Summary

  • Add discard all unstaged changes (reverts tracked files, leaves untracked alone)
  • Add discard all staged changes (unstages + reverts tracked files)
  • Add stash operations (stash, stash including untracked, pop stash)
  • Includes confirmation dialogs for destructive discard operations

Test plan

  • Test discard all unstaged with modified files
  • Test discard all staged with staged files
  • Test stash and pop stash cycle
  • Verify untracked files are preserved during discard operations

Summary by CodeRabbit

  • New Features

    • Discard all unstaged and staged changes with confirmation dialogs
    • Stash tracked changes, stash including untracked files, and pop stashes
    • New stash menu and grouped discard controls with visual feedback and toasts
  • Refactor

    • Header and actions reorganized into composed components; stash controls exposed via new props

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 18, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds five git helper functions (discard/stash/pop), re-exports them, exposes TRPC endpoints in the staging router, and wires stash/discard UI controls, dialogs, and mutations into ChangesView and ChangesHeader.

Changes

Cohort / File(s) Summary
Git Helper Functions
apps/desktop/src/lib/trpc/routers/changes/security/git-commands.ts
Adds five async helpers: gitDiscardAllUnstaged, gitDiscardAllStaged, gitStash, gitStashIncludeUntracked, gitStashPop. Each validates worktree, instantiates simpleGit, and runs the corresponding git command.
Module Exports
apps/desktop/src/lib/trpc/routers/changes/security/index.ts
Re-exports the five new git helpers from ./git-commands.
TRPC Endpoints
apps/desktop/src/lib/trpc/routers/changes/staging.ts
Adds five procedures: discardAllUnstaged, discardAllStaged, stash, stashIncludeUntracked, stashPop. Each accepts { worktreePath: string }, calls the helper, and returns { success: true }.
Changes UI
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/ChangesView/ChangesView.tsx
Adds mutations for the five operations with success/error toasts, refetch behavior, confirmation dialogs for discards, and passes stash callbacks + pending state to ChangesHeader.
ChangesHeader UI
apps/desktop/src/renderer/screens/main/components/WorkspaceView/Sidebar/ChangesView/components/ChangesHeader/ChangesHeader.tsx
Adds optional props onStash, onStashIncludeUntracked, onStashPop, isStashPending; introduces a Stash dropdown and restructures header to surface stash actions and base-branch selector.
Minor UI tweak
apps/desktop/src/renderer/.../CategorySection/CategorySection.tsx
Adds group class to header container; minor JSX/comment cleanup.

Sequence Diagram

sequenceDiagram
    actor User
    participant UI as ChangesView / ChangesHeader
    participant Mutation as TRPC Mutation
    participant Router as Staging Router
    participant Git as Git Helper (simpleGit)

    User->>UI: Trigger "Stash" / "Discard All" action
    UI->>Mutation: mutation.mutate({ worktreePath })
    Mutation->>Router: TRPC endpoint call
    Router->>Git: call gitStash / gitDiscardAll*
    Git->>Git: validate worktree & run git commands
    Git-->>Router: resolve/reject
    Router-->>Mutation: return { success: true } / error
    Mutation->>UI: update state, refetch status
    UI->>User: show success/error toast, update UI
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰
A nibble, a stash, then quiet and neat,
Changes tucked in a pocket, safe and discreet.
Pop them back later with a gentle hop—
Tiny rabbit cheers as the branches stop! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(desktop): add bulk git operations to changes sidebar' clearly and concisely summarizes the main change: adding multiple git operations (discard and stash functions) to the changes sidebar UI component.
Description check ✅ Passed The PR description provides a clear summary of changes, includes a test plan covering the main functionality, and follows the repository template structure with Summary and Test plan sections.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Add VSCode-like operations: discard all changes (staged/unstaged),
stash, stash including untracked, and pop stash. Includes confirmation
dialogs for destructive discard operations.
@Kitenite Kitenite force-pushed the discard-all-on-staged branch from ee09683 to 7943579 Compare January 18, 2026 21:20
Remove destructive color and hide discard buttons by default,
showing them only when hovering over the section header.
- Restructure header into two rows
- Row 1: Base branch selector, view mode toggle, refresh
- Row 2: Stash dropdown (with VscGitStash icon), PR status
- BaseBranchSelector: handles branch selection logic and UI
- StashDropdown: stash operations dropdown menu
- RefreshButton: refresh with spin animation
- PRStatusLink: PR status display with loading state
@Kitenite Kitenite merged commit 29277dc into main Jan 18, 2026
4 of 5 checks passed
@Kitenite Kitenite deleted the discard-all-on-staged branch January 18, 2026 21:50
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ⚠️ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

saddlepaddle pushed a commit that referenced this pull request Jan 18, 2026
* feat(desktop): add bulk git operations to changes sidebar

Add VSCode-like operations: discard all changes (staged/unstaged),
stash, stash including untracked, and pop stash. Includes confirmation
dialogs for destructive discard operations.

* style(desktop): show discard buttons only on hover like VSCode

Remove destructive color and hide discard buttons by default,
showing them only when hovering over the section header.

* refactor(desktop): make stash props required in ChangesHeader

* style(desktop): move stash/PR to second row, use VSCode git stash icon

- Restructure header into two rows
- Row 1: Base branch selector, view mode toggle, refresh
- Row 2: Stash dropdown (with VscGitStash icon), PR status

* style(desktop): move all action buttons to second row

* style(desktop): align all action buttons to start

* refactor(desktop): extract ChangesHeader into smaller components

- BaseBranchSelector: handles branch selection logic and UI
- StashDropdown: stash operations dropdown menu
- RefreshButton: refresh with spin animation
- PRStatusLink: PR status display with loading state
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.

1 participant