Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Git CleanerNew to Visual Studio Code? Get it now.
Git Cleaner

Git Cleaner

Poprygun

|
19 installs
| (0) | Free
A VS Code extension to clean up local git branches that are gone from the remote.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Git Cleaner VS Code Extension

This VS Code extension provides a convenient way to clean up local Git branches that no longer exist on the remote repository.

Features

  • Status Bar Icon: A trashcan icon labeled "Git Clean" appears in the VS Code status bar. Clicking this icon executes the cleanup command.
  • Command Palette Integration: You can also run the cleanup command from the VS Code Command Palette by searching for "Git Cleaner: Clean Gone Branches".

Requirements

  • Bash: This extension requires bash to be available in your system:
    • Linux/macOS: Bash is usually pre-installed
    • Windows: You need to install one of the following:
      • Git Bash
      • Windows Subsystem for Linux (WSL)
      • Any other bash implementation available in your PATH

Installation

  1. Clone the repository (or download the source code) into a directory on your machine.
  2. Open VS Code.
  3. Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X).
  4. Click on the ... (More Actions) menu in the top right of the Extensions view.
  5. Select Install from VSIX....
  6. Navigate to the directory where you cloned/downloaded the extension, and select the .vsix file (you'll need to package it first, see "Usage for Development").

Usage

Once installed and activated:

  1. Click the "Git Clean" icon in the VS Code status bar (usually at the bottom left).
  2. Alternatively, open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P) and type Git Cleaner: Clean Gone Branches and press Enter.

The extension will then:

  • Fetch and prune your remote branches (git fetch --prune).
  • Identify local branches that are marked as gone.
  • Delete these gone local branches.

Output and any errors will be shown in a VS Code information message.

Usage for Development

If you want to develop or test this extension:

  1. Clone the repository:

    git clone https://gitlab.com/poprygun/vsx-git-clean.git
    cd vsx-git-clean
    
  2. Install dependencies:

    pnpm i
    
  3. Run the extension in Development Host:

    • Open the project in VS Code.
    • Press F5 to open a new Extension Development Host window. The extension will be active in this new window.
  4. Package the extension (to create a .vsix file):

    pnpm build
    

    (You might need to answer Yes to the question first time)

Continuous Integration

This project uses GitLab CI for automated testing, building, and deployment:

  1. Testing: Runs linting and tests on every commit
  2. Building: Creates a packaged VSIX file for distribution
  3. Deployment: Publishes the extension to the VS Code Marketplace when changes are pushed to the main branch

To set up deployment, you need to configure the following in your GitLab project:

  1. Add a CI/CD variable named VSCE_PAT with your Visual Studio Marketplace Personal Access Token
  2. The deployment job is set to manual trigger by default for safety

For more information on obtaining a PAT, see the VS Code Publishing Extensions documentation.

Changelog

Version 0.0.4

  • Added check for bash availability on Windows
  • Added clear error message when bash is not found
  • Updated documentation with Windows requirements
  • Added custom extension icon
  • Converted SVG icons to PNG format for better compatibility

Version 0.0.3 and earlier

  • Initial implementation with bash support

Contributing

Feel free to open issues or submit pull requests if you have suggestions or find bugs.

License

This project is licensed under the MIT License - see the file for details.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft