GitSmash - Multi Git Config Manager
A minimal yet powerful VS Code extension for managing and switching between multiple git configurations. Perfect for developers who work with different git identities across projects.
Features
- Store Multiple Configs: Save unlimited git configurations with unique names
- Quick Switching: Switch between configs with a single click
- Flexible Scope: Apply configs locally (per repository) or globally (all repositories)
- Status Bar Indicator: Always see your current git user at a glance
- Tree View Sidebar: Visual interface for managing all your configs
- Full CRUD Operations: Add, edit, delete, and list configurations
- Current Config Detection: Automatically highlights the active configuration
Installation
From Source
- Clone this repository
- Run
npm install to install dependencies
- Run
npm run compile to compile TypeScript
- Press F5 in VS Code to launch Extension Development Host
- Test the extension in the new window
From VSIX (Local Installation)
- Package the extension:
vsce package
- Install:
code --install-extension gitsmash-0.1.0.vsix
- Reload VS Code
Updating the Extension
After making changes to the source code:
Quick update:
./update-extension.sh
Manual update:
code --uninstall-extension gitsmash.gitsmash
npm run compile && vsce package
code --install-extension gitsmash-0.1.0.vsix
Then reload VS Code: Cmd+Shift+P → "Developer: Reload Window"
See UPDATE.md for detailed instructions.
Usage
Adding a Configuration
- Open Command Palette (
Cmd+Shift+P / Ctrl+Shift+P)
- Type "GitSmash: Add Git Config"
- Follow the prompts to enter:
- Unique key (e.g., "work", "personal")
- Display name
- Git user name
- Git user email
- Choose whether to apply it immediately
Or click the "+" button in the GitSmash sidebar.
Switching Configurations
Method 1: Status Bar
- Click the git config indicator in the status bar
- Select a configuration
- Choose scope (Local or Global)
Method 2: Command Palette
- Run "GitSmash: Switch Git Config"
- Select a configuration
- Choose scope (Local or Global)
Method 3: Tree View
- Open the GitSmash sidebar
- Click on any configuration to switch to it
Editing a Configuration
- Open Command Palette
- Run "GitSmash: Edit Git Config"
- Select the configuration to edit
- Choose which field to modify
- Enter the new value
Or right-click a config in the sidebar and select "Edit".
Deleting a Configuration
- Open Command Palette
- Run "GitSmash: Delete Git Config"
- Select the configuration to delete
- Confirm the deletion
Or right-click a config in the sidebar and select "Delete".
Listing All Configurations
- Open Command Palette
- Run "GitSmash: List All Git Configs"
- View all saved configurations with details
- Select one for quick actions
Commands
| Command |
Description |
GitSmash: Switch Git Config |
Switch to a different git configuration |
GitSmash: Add Git Config |
Add a new git configuration |
GitSmash: Edit Git Config |
Edit an existing configuration |
GitSmash: Delete Git Config |
Delete a configuration |
GitSmash: List All Git Configs |
View all saved configurations |
UI Components
Status Bar
Shows your current git user in the bottom-left corner:
$(git-branch) John Doe (local) - Active local config
$(git-branch) Personal (global) - Active global config
$(git-branch) No git config - No config set
$(git-branch) Not a git repo - Current workspace isn't a git repository
Click the status bar item to quickly switch configs.
Located in the Activity Bar with a git branch icon:
- Shows all saved configurations
- Active config marked with a green checkmark
- Displays email address as description
- Right-click for context menu (Edit, Delete)
- Click any config to switch to it
Scope: Local vs Global
Local (Recommended)
- Applies to the current repository only
- Uses
git config --local
- Stored in
.git/config of your repository
- Different repos can have different configs
Global
- Applies to all repositories on your machine
- Uses
git config --global
- Stored in
~/.gitconfig
- Affects all repos unless overridden locally
Examples
Example 1: Work and Personal Projects
Saved Configs:
1. "Work" - work-key
User: John Doe
Email: john.doe@company.com
2. "Personal" - personal-key
User: John
Email: john@personal.com
Switch between them when working on different projects!
Example 2: Multiple Clients
Saved Configs:
1. "Client A" - client-a
User: John Doe
Email: john@clienta.com
2. "Client B" - client-b
User: John Doe
Email: john@clientb.com
3. "Open Source" - oss
User: johndoe
Email: johndoe@users.noreply.github.com
Storage
- Configurations are stored in VS Code's
globalState
- Available across all workspaces
- Persists across VS Code restarts
- Never stores your git credentials (only username and email)
Requirements
- VS Code 1.85.0 or higher
- Git installed and in PATH
- A workspace with a git repository (for switching configs)
Known Limitations
- Only manages
user.name and user.email
- Doesn't manage other git configs (signing, aliases, etc.)
- Requires workspace to be a git repository for most operations
- Tree view doesn't show configs if extension is not activated
Tips
- Use Local Scope: Always prefer local scope unless you want to change your global git config
- Descriptive Names: Use clear names like "Work - Acme Corp" instead of just "Work"
- Email Validation: The extension validates email format to prevent typos
- Quick Access: Pin the GitSmash sidebar for fastest access
- Status Bar: Quickly verify which config is active before committing
Troubleshooting
"Not a git repository" error
- Ensure your workspace folder contains a
.git directory
- Open a folder that has been initialized with
git init
Configs not appearing
- Check if the extension is activated (look for status bar item)
- Try refreshing the tree view with the refresh button
Git not found
- Ensure git is installed on your system
- Add git to your system PATH
- Restart VS Code after installing git
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
License
MIT License - See LICENSE file for details
Changelog
Version 0.1.0
- Initial release
- Add, edit, delete git configurations
- Switch between configs (local/global scope)
- Status bar indicator
- Tree view sidebar
- Current config detection
Support
If you encounter any issues or have feature requests, please file an issue on the GitHub repository.
Made with ❤️ for developers who juggle multiple git identities