Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 3, 2025

  • Add autoStashOnCheckout setting to package.json configuration
  • Add localization strings for the new setting to package.nls.json
  • Add setting key constant to src/common/settingKeys.ts
  • Implement auto-stash logic in src/view/reviewManager.ts switch method
  • Track stashed state in FolderRepositoryManager
  • Modify checkoutDefaultBranch in activityBarViewProvider and pullRequestOverview to pop stash when appropriate
  • Run lint and hygiene checks
  • Create manual test verification plan
  • Address all code review feedback
  • Resolve merge conflicts and update branch

Summary

This PR implements a new setting githubPullRequests.autoStashOnCheckout that allows users to automatically stash their uncommitted changes when checking out a pull request, and automatically restore those changes when returning to the default branch.

Implementation Details:

  1. New Setting: Added autoStashOnCheckout (boolean, default: false)

    • Declared in package.json with proper localization
    • Constant added to settingKeys.ts
  2. Auto-Stash on PR Checkout (ReviewManager.switch):

    • Only adds working tree changes to staging (index changes are already staged)
    • Executes git stash command
    • Sets stashedOnCheckout flag in FolderRepositoryManager
    • Gracefully handles stash failures without blocking checkout
  3. Auto-Pop on Default Branch Checkout:

    • Reads stashedOnCheckout flag AFTER successful checkout
    • Executes git stashPop command
    • Clears stashedOnCheckout flag
    • Gracefully handles pop failures with user warnings
  4. Error Handling:

    • Stash failures show warnings but don't block PR checkout
    • Pop failures show warnings and preserve stash for manual resolution
    • All operations properly logged

User Experience:

  • Enabled: Seamless switching between work and PR reviews without manual stash management
  • Disabled (default): No behavior change - existing uncommitted changes handling preserved
  • Resilient: Errors don't break the workflow, just warn the user

Merge Updates:

  • Resolved conflicts with main branch
  • Updated to use new ESLint configuration (eslint.config.mjs)
  • Updated imports to include new uuid utility
  • All lint and hygiene checks passing
Original prompt

This section details on the original issue you should resolve

<issue_title>Stash changes before entering review mode</issue_title>
<issue_description>It would be soooo cool if I could review a pull request without having to commit or stash stuff myself.

Would it be possible for this extension to stash changes before checking out the PR branch, and then upon exiting review mode checkout the previous branch and pop the stash? 😍 </issue_description>

<agent_instructions>Add a setting to automatically stash when checking out a PR, and pop when using the "checkout default branch", if changes were stashed upon checkout.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

Fixes #514

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits October 3, 2025 10:33
- Add autoStashOnCheckout setting
- Implement auto-stash logic when checking out PR
- Pop stash when returning to default branch

Co-authored-by: alexr00 <[email protected]>
- Fix redundant check for empty files
- Don't re-add already staged index changes
- Fix race condition by reading stash flag after checkout

Co-authored-by: alexr00 <[email protected]>
Copilot AI changed the title [WIP] Add automatic stash feature for reviewing pull requests Add auto-stash setting for seamless PR checkout workflow Oct 3, 2025
Copilot AI requested a review from alexr00 October 3, 2025 10:56
Copilot finished work on behalf of alexr00 October 3, 2025 10:56
@alexr00
Copy link
Member

alexr00 commented Nov 12, 2025

@copilot resolve conflicts and update the branch.

Resolved conflicts in:
- src/@types/vscode.proposed.chatParticipantAdditions.d.ts
- src/github/activityBarViewProvider.ts

Co-authored-by: alexr00 <[email protected]>
Copy link
Contributor Author

Copilot AI commented Nov 12, 2025

@copilot resolve conflicts and update the branch.

Conflicts resolved and branch updated with latest main. Commit c364c6a merges the changes successfully. All lint and hygiene checks are passing.

Copilot finished work on behalf of alexr00 November 12, 2025 12:01
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.

Stash changes before entering review mode

2 participants