PowerShell NavigationCmdletProvider for Git branch navigation and analysis.
Browse branches with cd/ls, view commit diffs with Get-Content, checkout with Invoke-Item, and analyze branches with PowerShell pipelines.
# Navigate to any git repository and mount
cd C:\MyRepo
gcd # mounts Git:\ and navigates to current branch
# Browse
dir # branches + commits
cd feature\login # enter a child branch
Get-Content .\abc1234 # view commit diff
cd .. # back to parent
ii .\feature\login # git checkoutRun the following in a PowerShell 7 console:
Install-PSResource GitDriveRequires:
- PowerShell 7.4+
- .NET 8.0 SDK (for building)
Git:\
master # root branch (main or master)
Git:\master\
feature/ # namespace folder (groups feature/* branches)
hotfix/ # namespace folder
bugfix-test # child branch
abc1234 # commit (leaf)
def5678 # commit
Git:\master\feature\
login # branch feature/login
signup # branch feature/signup
Git:\master\feature\login\
abc1234 # commit unique to this branch
def5678 # commit unique to this branch
- Branches = containers (blue,
cdinto them) - Commits = leaves (yellow SHA, view with
Get-Content) - Namespace folders = virtual grouping for
/-containing branch names
| Command | Description |
|---|---|
gcd |
Mount drive and navigate to current branch |
gcd feature/login |
Mount and navigate to specific branch |
gcd abc1234 |
Mount and navigate to specific commit |
dir |
List child branches + commits |
dir -Recurse |
Show full branch hierarchy (no commits) |
cd feature\login |
Enter child branch |
cd .. |
Go up |
| Command | Description |
|---|---|
New-Item .\new-branch -Value master |
Create branch from master |
Remove-Item .\old-branch -Recurse |
Delete branch |
Rename-Item .\old -NewName new |
Rename branch |
Invoke-Item .\feature\login |
Checkout branch (git checkout) |
| Command | Description |
|---|---|
Get-Content .\abc1234 |
Show commit diff/patch |
Get-Item .\feature\login |
Branch details |
Get-Item .\abc1234 |
Commit details |
| Column | Description |
|---|---|
| Name | Branch name (blue) or commit SHA (yellow) |
| Ahead | Commits ahead of parent branch (+5) |
| Date | Commit/tip date |
| Author | Commit/tip author |
| Message | Commit/tip message |
| Refs | Branches, tags, HEAD -> pointing to this commit |
Current branch is marked with *. Namespace folders show branch count.
GitDrive outputs typed objects, enabling PowerShell pipeline operations that are difficult with git CLI.
Get-ChildItem -Recurse |
Where-Object { $_.IsBranch -and $_.Ahead -eq 0 -and -not $_.IsCurrent }Get-ChildItem -Recurse |
Where-Object { $_.IsBranch -and $_.Date -lt (Get-Date).AddMonths(-3) } |
Sort-Object DateGet-ChildItem -Recurse |
Where-Object IsBranch |
Sort-Object Ahead -Descending |
Select-Object -First 5 Name, AheadGet-ChildItem -Recurse |
Where-Object { $_.IsBranch -and $_.Author -match 'yotsuda' }$b = Get-ChildItem -Recurse | Where-Object IsBranch
[PSCustomObject]@{
Total = $b.Count
Merged = ($b | Where-Object { $_.Ahead -eq 0 }).Count
Stale = ($b | Where-Object { $_.Date -lt (Get-Date).AddMonths(-3) }).Count
Active = ($b | Where-Object { $_.Date -gt (Get-Date).AddMonths(-1) }).Count
}$master = Get-ChildItem Git:\master | Where-Object { -not $_.IsBranch }
$feature = Get-ChildItem Git:\master\feature\login
Compare-Object $master $feature -Property Sha -PassThru |
Select-Object @{N='Side';E={$_.SideIndicator}}, @{N='Sha';E={$_.ShortSha}}, ShortMessageGet-ChildItem -Recurse |
Where-Object { $_.IsBranch -and $_.Ahead -eq 0 -and -not $_.IsCurrent } |
Remove-Item -RecurseItems output by Get-ChildItem are GitCommitInfo objects with these properties:
| Property | Type | Description |
|---|---|---|
| Name | string | Branch name or short SHA |
| Sha | string | Full commit SHA |
| Message | string | Commit message |
| Author | string | Author name |
| Date | DateTime | Author date |
| Ahead | int | Commits ahead of parent (branches only) |
| Refs | string | Branches/tags pointing to this commit |
| IsBranch | bool | True for branches |
| IsNamespace | bool | True for namespace folders |
| IsCurrent | bool | True for checked-out branch |
| ShortSha | string | 7-char SHA |
| ShortMessage | string | First line of message |
| DateStr | string | yyyy-MM-dd format |
| Operation | First | Cached |
|---|---|---|
dir (root) |
0.02s | 0.02s |
dir (39 branches) |
1.0s | 0.3s |
dir -Recurse (39 branches) |
14s | 0.5s |
Cache TTL is 30 seconds. Invalidated automatically after create/delete/rename.