git-sw-plugin
v1.0.0
Published
Interactive CLI tool to install git skip-worktree aliases and prompt info
Downloads
96
Maintainers
Readme
git-sw-plugin
Interactive CLI tool to install git skip-worktree aliases and prompt info for bash and zsh shells.
Features
Git Aliases: Convenient commands for managing skip-worktree files
git-sw-list- List all skip-worktree filesgit-sw- Add modified files to skip-worktreegit-unsw- Remove all files from skip-worktree
Prompt Info: Display skip-worktree file count in your shell prompt
- Customizable icon/emoji
- Customizable colors
- Automatic integration with Oh-My-Zsh themes (bullet-train, agnoster, etc.)
- Live preview during configuration
Installation
Using npx (Recommended)
npx git-sw-plugin installUninstall
npx git-sw-plugin uninstallSupported Shells
- Bash (with .bashrc, .bash_profile, or .profile)
- Zsh (with .zshrc)
- Oh-My-Zsh themes (automatic detection)
How It Works
- Auto-Detection: Detects your shell, RC files, and Oh-My-Zsh setup
- Interactive Configuration: Choose features, icons, and colors with live preview
- Smart Installation: Uses the best strategy for your prompt setup:
- Oh-My-Zsh with prompt order: Fully automatic
- Oh-My-Zsh themes: Segment function + instructions
- Custom prompts: Function + manual integration guide
- Safe Modifications: Creates backups before making changes
Usage Examples
Git Aliases
After installation:
# List skip-worktree files
git-sw-list
# Add modified files to skip-worktree
git-sw
# Remove all files from skip-worktree
git-unswPrompt Display
When you have files marked as skip-worktree, your prompt will show:
~/projects/myapp (main) 🔒 SW:3 ❯The count updates automatically as you add/remove skip-worktree files.
What is skip-worktree?
Git's skip-worktree feature allows you to tell Git to ignore changes to tracked files. This is useful for:
- Local configuration files you don't want to commit
- Development environment customizations
- Temporary modifications for testing
Unlike .gitignore, skip-worktree works on tracked files.
Development
Project Structure
install-git-sw-plugin/
├── bin/
│ └── cli.js # Executable entry point
├── src/
│ ├── index.js # Main orchestrator
│ ├── shell-detector.js # Shell and environment detection
│ ├── rc-file-manager.js # Safe RC file modifications
│ ├── prompt-parser.js # Parse existing prompts
│ ├── prompt-builder.js # Generate shell-specific code
│ ├── preview.js # Preview system (hybrid)
│ ├── ui.js # Interactive UI with enquirer
│ └── installer.js # Installation logic
├── package.json
└── README.mdTechnologies
- enquirer: Interactive CLI prompts
- chalk: Terminal colors and styling
- Node.js built-in modules for shell execution and file operations
Troubleshooting
"No RC file found"
Create an RC file first:
# For bash
touch ~/.bashrc
# For zsh
touch ~/.zshrc"Cannot write to RC file"
Check file permissions:
chmod u+w ~/.zshrc # or ~/.bashrcPrompt not showing skip-worktree info
- Make sure you've reloaded your shell:
source ~/.zshrc - Check if manual integration is required (shown during installation)
- For Oh-My-Zsh: Verify
gitskipworktreewas added to your prompt order
Contributing
This is a local development project. To contribute:
- Make changes in the appropriate module
- Test with both bash and zsh
- Test with and without Oh-My-Zsh
License
MIT
