Skip to content

Guliveer/windows-context-git

Repository files navigation

windows-context-git

A Windows Explorer context menu extension that adds a Git submenu when right-clicking a folder. The submenu only appears in directories that contain a git repository.

Platform .NET License

Features

Option Description
Status Lists modified, staged, and untracked files with color coding
Fetch Fetch changes from the remote repository (streaming output)
Pull Fetch and merge remote changes
Push Send local commits — grayed out when there is nothing to push
Commit Stage/unstage files, enter a commit message, Commit & Push
Branch / Checkout List branches, switch branch, create a new branch

Each operation opens a separate WPF window with a dark theme (OLED dark, Slate palette).

Project structure

GitContextMenu.slnx
├── src/
│   ├── GitContextMenu.Core/            # netstandard2.0 — shared logic
│   │   ├── Detection/                  # GitRepositoryDetector (filesystem only, no git.exe)
│   │   └── Git/                        # GitService, parsers, models
│   ├── GitContextMenu.ShellExtension/  # net48 — COM DLL (SharpShell)
│   └── GitContextMenu.UI/              # net10.0-windows — WPF App
├── tests/
│   └── GitContextMenu.Core.Tests/      # xUnit, 20 tests
└── tools/
    ├── Register.ps1                    # register the DLL (requires admin)
    ├── Unregister.ps1                  # unregister the DLL
    └── Deploy-Dev.ps1                  # build + deploy for local dev

Requirements

Installation (dev)

git clone https://github.com/Guliveer/windows-context-git
cd windows-context-git

# Build + copy UI.exe next to the DLL + register (run as Administrator)
.\tools\Deploy-Dev.ps1

The script builds both projects, copies the files, and restarts Explorer automatically.

Manual registration

# Run as Administrator
dotnet build src/GitContextMenu.ShellExtension -c Debug
dotnet build src/GitContextMenu.UI -c Debug
.\tools\Register.ps1

Unregistration

# Run as Administrator
.\tools\Unregister.ps1

Windows 11

Windows 11 shows a simplified context menu by default. The Git submenu will appear after clicking "Show more options" or by using Shift + Right-click.

To restore the classic context menu globally:

reg add "HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32" /f /ve

Testing the UI without registration

.\src\GitContextMenu.UI\bin\Debug\net10.0-windows\GitContextMenu.UI.exe `
    --operation status --repo "C:\path\to\repo"

Available operations: status, commit, branch, fetch, pull, push

Tests

dotnet test tests/GitContextMenu.Core.Tests

Architecture

Explorer.exe
  └── COM → GitShellExtension.dll (net48, SharpShell)
               ├── GitRepositoryDetector  — detects .git via filesystem (no process spawn)
               ├── CommitCache            — 30s TTL cache for Push enabled/disabled state
               └── Process.Start() → GitContextMenu.UI.exe (net10, WPF)
                                         ├── StatusViewModel  → git status --porcelain=v2
                                         ├── CommitViewModel  → git add / git commit
                                         ├── BranchViewModel  → git branch / git checkout
                                         └── OperationViewModel → streaming git fetch/pull/push

The UI runs as a separate process — a crash in the window cannot crash Explorer.

License

MIT

About

Windows Explorer context menu extension adding a Git submenu — Status, Commit, Branch, Fetch, Pull, Push — with a dark WPF UI

Resources

Stars

Watchers

Forks

Used by

Contributors

Languages