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
Click ⎇ Switch Branch in the bottom status bar
Pick a branch from the list
Your current changes are stashed automatically (labeled by branch name)
The selected branch is checked out
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