New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

git-sw-plugin

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-sw-plugin

Interactive CLI tool to install git skip-worktree aliases and prompt info

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
5
66.67%
Maintainers
1
Weekly downloads
 
Created
Source

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 files
    • git-sw - Add modified files to skip-worktree
    • git-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

npx git-sw-plugin install

Uninstall

npx git-sw-plugin uninstall

Supported 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-unsw

Prompt 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.md

Technologies

  • 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 ~/.bashrc

Prompt 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 gitskipworktree was 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

Keywords

git

FAQs

Package last updated on 06 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts