Skip to content
| Marketplace
Sign in
Visual Studio Code>SCM Providers>Git SohjiNew to Visual Studio Code? Get it now.
Git Sohji

Git Sohji

badfalcon

|
7 installs
| (0) | Free
A VS Code extension for cleaning up Git branches (detect and delete dead/stale/gone branches, with full branch management).
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Git Sohji

English

A VS Code extension for cleaning up Git branches (detect and delete dead/stale/gone branches, with full branch management). "Sohji" means "cleaning" in Japanese.

  • Command: Git Sohji: Open (gitsouji.openCleaner)
  • You can also launch it from the SCM (Source Control) view title bar, or from the Git Sohji icon in the Activity Bar.

Features

Branch Cleaner Webview

  • Shows Local Branches / Remote Branches with status badges (merged/stale/gone)
  • Sticky header: The top toolbar, cleanup toolbar, and search bar stay pinned while scrolling long branch lists
  • Search bar: Filter branches by name (supports case sensitivity and regex)
  • Settings button: Quick access to extension settings
  • Local:
    • Checkout
    • Log (opens git log --oneline --graph --decorate in a terminal)
    • Rename (not allowed for protected branches)
    • Delete (not allowed for protected branches; confirmation/force are configurable)
    • Merge into current (merge into current branch; protected branches cannot be selected)
  • Remote:
    • Checkout (creates a local tracking branch if it doesn't exist)
    • Log
    • Delete Remote (not allowed for protected branches)

Cleanup Toolbar

  • Merged: Find branches already merged into the base branch
  • Stale: Find branches with no commits for N days (configurable)
  • Gone: Find branches whose upstream was deleted
  • Cleanup All: Combine all three detections for bulk preview
  • Detected branches open in a preview modal where you can review them and stage selected entries into the Deletion Queue

Deletion Queue (Activity Bar View)

  • Git Sohji has its own Activity Bar container with a Deletion Queue tree view
  • Branches added from cleanup previews or from row selection show up as queue items with per-item status icons (pending / spinning / ✓ / ✗)
  • View title actions:
    • Execute (▶): Run all queued deletions; progress is reported via a VS Code notification with per-item updates in the tree
    • Clear: Empty the queue
    • Switch Repository: Re-pick the active repository in multi-folder workspaces (the last-used repo is remembered via workspaceState)
  • Inline item action: Remove (✕) on pending items
  • Welcome content links to Open Git Sohji when the queue is empty
  • Single-row Delete buttons in the webview bypass the queue and execute immediately

Branch Selection

  • Selection checkboxes are always available to manually pick branches for deletion — no mode to toggle
  • Works for both local and remote branches simultaneously
  • A select-all checkbox appears in each table header to toggle all currently visible (filtered) rows at once; combine with the search bar to bulk-select matching branches
  • Selected branches are staged into the Deletion Queue for later execution

Force Delete Confirmation

  • When the queue contains unmerged branches that fail git branch -d, shows a confirmation dialog to retry with force delete (-D)
  • Also confirms when deleting remote branches with the same name as local (untracked)

Requirements

  • Git must be available (git command executable)

Usage

  1. Open a folder containing a Git repository in VS Code
  2. Run Git Sohji: Open from the Command Palette
    • Or run it from the SCM view menu
    • Or click the Git Sohji icon in the Activity Bar
  3. Use the buttons in the webview to browse, search, and stage branches
  4. Open the Deletion Queue view in the Activity Bar to review staged items and click Execute to delete them

Commands

  • gitsouji.openCleaner — Git Sohji: Open (opens the branch manager webview)
  • gitsouji.switchRepository — Switch Repository (re-pick the active repo in multi-folder workspaces)
  • gitsouji.queue.execute — Execute Deletion Queue
  • gitsouji.queue.clear — Clear Deletion Queue

Extension Settings

Example settings.json:

{
  "gitSouji.baseBranch": "auto",
  "gitSouji.staleDays": 30,
  "gitSouji.autoFetchPrune": false,
  "gitSouji.protectedBranches": ["main", "master", "develop", "release/*"],
  "gitSouji.confirmBeforeDelete": true,
  "gitSouji.forceDeleteLocal": false,
  "gitSouji.allowRemoteBranchDeletion": false,
  "gitSouji.includeRemoteInDeadCleanup": false,
  "gitSouji.showStatusBadges": true
}

Detection Settings

  • gitSouji.baseBranch: Base branch for merged-branch detection. Set to auto to use origin/HEAD, or fallback to main/master/develop.
  • gitSouji.staleDays: Number of days since last commit to consider a branch as stale (default: 30).
  • gitSouji.autoFetchPrune: Run git fetch --prune automatically before detecting gone branches.

Protection Settings

  • gitSouji.protectedBranches: Branches excluded from delete, rename, and merge-source actions. Supports glob patterns (e.g., release/*).

Deletion Settings

  • gitSouji.confirmBeforeDelete: Show confirmation dialog before delete operations.
  • gitSouji.forceDeleteLocal: Use git branch -D (force) instead of git branch -d when deleting local branches.
  • gitSouji.allowRemoteBranchDeletion: Enable remote branch deletion buttons and cleanup (default: false).
  • gitSouji.includeRemoteInDeadCleanup: Also delete corresponding remote branches when cleaning up local branches.

Display Settings

  • gitSouji.showStatusBadges: Show merged/stale/gone status badges in the branch list.

Implementation Notes

  • The webview HTML is at media/branchManager.html. CSP/nonce are injected at runtime.
  • The core TypeScript logic is in src/app.ts.
  • The deletion queue is owned by src/queue/queueTreeProvider.ts (a native VS Code TreeDataProvider). The webview stages items into the queue via addToQueue messages; the queue itself runs in the extension host.

Known Issues

  • You may see Error mutex already exists in test logs; vscode-test can still exit with code 0 (possible VS Code process contention on the machine).

Development

npm install
npm test

日本語

Git ブランチの整理(掃除)に特化した VS Code 拡張です(デッド/古い/削除済みリモートのブランチ検出・削除、その他ブランチ管理機能)。

  • コマンド: Git Sohji: 開く (gitsouji.openCleaner)
  • SCMビュー(Source Control)のタイトルバー、またはアクティビティバーの Git Sohji アイコンからも起動できます

Features

Branch Cleaner Webview

  • Local Branches / Remote Branches をステータスバッジ(マージ済み/古い/削除済み)付きで一覧表示
  • 固定ヘッダー: 上部ツールバー・整理ツールバー・検索バーをスクロールしても常に画面上部に固定
  • 検索バー: ブランチ名でフィルタリング(大文字小文字区別・正規表現対応)
  • 設定ボタン: 拡張機能の設定に素早くアクセス
  • Local:
    • Checkout
    • Log(ターミナルで git log --oneline --graph --decorate を開く)
    • Rename(保護ブランチは不可)
    • Delete(保護ブランチは不可・設定で確認/force制御)
    • Merge into current(現在ブランチへマージ。保護ブランチは不可)
  • Remote:
    • Checkout(追跡ローカルが無ければ作成してcheckout)
    • Log
    • Delete Remote(保護ブランチは不可)

整理ツールバー

  • Merged: ベースブランチにマージ済みのブランチを検出
  • Stale: N日間コミットがないブランチを検出(日数は設定可能)
  • Gone: 上流が削除されたブランチを検出
  • Cleanup All: 3種類すべての検出をまとめてプレビュー
  • 検出結果はプレビューモーダルに表示され、選択した項目を 削除キュー に積めます

削除キュー(アクティビティバーのビュー)

  • Git Sohji 専用の アクティビティバーコンテナ に Deletion Queue ツリービューを表示
  • クリーンアッププレビューや選択モードから追加したブランチがキュー項目として並び、各項目に状態アイコン(待機 / 実行中 / ✓ / ✗)が付きます
  • ビュータイトルアクション:
    • Execute(▶): キューに積んだ削除を一括実行。VS Code の通知でプログレスを表示し、ツリー上で項目ごとの状態が更新されます
    • Clear: キューを空にする
    • Switch Repository: マルチフォルダワークスペースでアクティブリポジトリを再選択(最後に使ったリポジトリは workspaceState に保存)
  • インラインアクション: 待機中の項目に Remove(✕)
  • キューが空のときは Welcome ビューから Open Git Sohji を起動可能
  • Webview の各行 Delete ボタンはキューを経由せず即時実行

選択モード

  • 選択モードをオンにして、削除するブランチを手動で選択
  • ローカル・リモートを同時に選択可能
  • 各テーブルのヘッダーに 全選択チェックボックス が表示され、現在表示中(フィルタ後)の行をまとめてオン/オフ切替可能。検索バーと組み合わせて該当ブランチだけを一括選択できます
  • 選択したブランチは削除キューに積まれ、まとめて実行できます

強制削除確認

  • キュー実行時、git branch -d でマージ未済のため失敗した場合、強制削除(-D)で再試行する確認ダイアログを表示
  • 同名のリモートブランチ(未追跡)を削除する際も確認を表示

Requirements

  • Git が利用可能であること(git コマンドが実行できる)

Usage

  1. Gitリポジトリを含むフォルダをVS Codeで開く
  2. コマンドパレットで Git Sohji: 開く を実行
    • または SCM ビュー上部のメニューから実行
    • またはアクティビティバーの Git Sohji アイコンから起動
  3. Webview上のボタンでブランチを閲覧・検索し、削除キューに積む
  4. アクティビティバーの Deletion Queue ビューで内容を確認し、Execute で削除を実行

コマンド

  • gitsouji.openCleaner — Git Sohji: 開く(ブランチ管理 Webview を開く)
  • gitsouji.switchRepository — Switch Repository(マルチフォルダワークスペースで対象リポジトリを切り替え)
  • gitsouji.queue.execute — Execute Deletion Queue
  • gitsouji.queue.clear — Clear Deletion Queue

Extension Settings

settings.json 例:

{
  "gitSouji.baseBranch": "auto",
  "gitSouji.staleDays": 30,
  "gitSouji.autoFetchPrune": false,
  "gitSouji.protectedBranches": ["main", "master", "develop", "release/*"],
  "gitSouji.confirmBeforeDelete": true,
  "gitSouji.forceDeleteLocal": false,
  "gitSouji.allowRemoteBranchDeletion": false,
  "gitSouji.includeRemoteInDeadCleanup": false,
  "gitSouji.showStatusBadges": true
}

検出設定

  • gitSouji.baseBranch: マージ済みブランチ検出の基準ブランチ。auto の場合は origin/HEAD を使用し、無ければ main/master/develop を順に探索。
  • gitSouji.staleDays: 最終コミットから何日経過したブランチを「古い」と見なすか(デフォルト: 30)。
  • gitSouji.autoFetchPrune: Gone ブランチ検出前に git fetch --prune を自動実行。

保護設定

  • gitSouji.protectedBranches: 削除・リネーム・マージ元指定の対象外とするブランチ。glob パターン対応(例: release/*)。

削除設定

  • gitSouji.confirmBeforeDelete: 削除操作前に確認ダイアログを表示。
  • gitSouji.forceDeleteLocal: ローカルブランチ削除時に git branch -D(強制)を使用。
  • gitSouji.allowRemoteBranchDeletion: リモートブランチの削除ボタンと整理機能を有効にする(デフォルト: false)。
  • gitSouji.includeRemoteInDeadCleanup: ローカルブランチ整理時に、対応するリモートブランチも削除。

表示設定

  • gitSouji.showStatusBadges: ブランチ一覧にマージ済み/古い/削除済みのステータスバッジを表示。

Implementation Notes

  • WebviewのHTMLは media/branchManager.html に置いてあり、起動時にCSP/nonceを差し込んで読み込みます。
  • TypeScript側のメインロジックは src/app.ts に集約しています。
  • 削除キューは src/queue/queueTreeProvider.ts(VS Code ネイティブの TreeDataProvider)が保持・実行します。Webview は addToQueue メッセージで項目を積み、実行自体は拡張ホスト側で行います。

Known Issues

  • テスト実行ログに Error mutex already exists が出る場合がありますが、vscode-test 自体は Exit code 0 で完了します(環境上の既存VS Codeプロセス競合の可能性)。

Development

npm install
npm test

If you find a bug or have a feature request, please open an issue.

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