Lock Stage File
Prevent accidental staging of files in Git by locking them. Perfect for when you're working on multiple features simultaneously and need to keep certain files unstaged.
Features
- Lock/Unlock files to prevent them from being staged
- Visual badge indicator on locked files in the Source Control view
- Custom staging buttons that automatically filter out locked files
- Stage All Unlocked command to stage only unlocked changes
- Per-workspace persistence - lock states are saved automatically
Usage
Locking Files
From Source Control View:
- Click the key icon (🔑) button next to any file in the "Changes" section to toggle its lock state
From Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
Lock Stage: Toggle File Lock
Lock Stage: Lock File from Staging
Lock Stage: Unlock File for Staging
Staging Files
Use the custom staging buttons to stage only unlocked files:
- Stage Unlocked File - The "+" button next to each file stages only if the file is unlocked
- Stage All Unlocked Changes - Button in the toolbar or Changes group header that stages all unlocked files
Note: Git's built-in staging buttons are still available but don't respect file locks. Always use the Lock Stage File extension's buttons to ensure locked files aren't staged. You can de-select the regular staging buttons from view to only have the custom staging buttons available.
Managing Locks
Clear All Locks:
- Command Palette →
Lock Stage: Clear All File Locks
Auto-Unstage:
- If you lock a file that's already staged, it will be automatically unstaged
How It Works
The extension creates custom staging commands that:
- Check each file's lock status before staging
- Filter out locked files
- Stage only unlocked files using Git's API
Locked files remain in your working directory but cannot be staged using the extension's staging buttons.
Requirements
- VS Code 1.105.0 or higher
- Git repository
Extension Settings
This extension does not add any VS Code settings. Lock states are managed per workspace and stored automatically in workspace state.
Known Issues
- Only supports Git (other SCM providers not supported)
- Multi-root workspaces only track the first workspace folder
- Git's built-in staging buttons bypass the lock mechanism (use the extension's buttons instead)
Release Notes
0.1.0
Initial release:
- Lock/unlock files from staging
- Custom staging buttons for unlocked files
- Visual badge indicators for locked files
- Per-workspace lock persistence
- Auto-unstage functionality
Contributing
Found a bug or have a feature request? Please open an issue on GitHub.
License
MIT License - see LICENSE file for details.