Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Auto StashNew to Visual Studio Code? Get it now.
Auto Stash

Auto Stash

Moshe Cohen

|
1 install
| (0) | Free
Switch Git branches with automatic stash and restore — never lose uncommitted changes again.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Auto Stash

Never lose uncommitted changes when switching Git branches again.

Auto Stash adds a ⎇ Switch Branch button to your VS Code status bar. When you switch branches, it automatically stashes your current changes, switches the branch, and restores any previously stashed changes for that branch.


How It Works

  1. Click ⎇ Switch Branch in the bottom status bar
  2. Pick a branch from the list
  3. Your current changes are stashed automatically (labeled by branch name)
  4. The selected branch is checked out
  5. Any previously stashed changes for that branch are restored automatically

Features

  • ✅ Auto stash on branch switch
  • ✅ Auto restore stash on arrival
  • ✅ Stashes untracked files too
  • ✅ Never touches your manual stashes
  • ✅ Prevents duplicate stashes per branch
  • ✅ Race condition protection — button locks while switching
  • ✅ Works on Windows, Mac, and Linux
  • ✅ No configuration needed

Why Not Just Use Git Hooks?

Git does not have a pre-checkout hook, meaning there is no native way to run a script before a branch switch happens. Auto Stash solves this by replacing the switch action entirely with its own status bar button that stashes your changes before switching.


Requirements

  • Git installed and available in PATH
  • A workspace with a Git repository

Commands

Command Description
Auto Stash: Switch Branch Open branch picker with auto stash

Notes

  • Stashes are labeled autostash::<branch-name> so they're easy to identify
  • One stash per branch is kept at all times — switching twice replaces the previous stash
  • Manual stashes are never modified or deleted

Release Notes

1.0.0

  • Initial release
  • Status bar button for branch switching
  • Auto stash on switch with untracked files support
  • Auto restore on arrival
  • Race condition protection
  • Manual stash isolation via autostash:: prefix
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft