en-US/about_GitDrive.help.txt
|
TOPIC about_GitDrive SHORT DESCRIPTION A PowerShell provider for navigating Git branches like a file system. LONG DESCRIPTION GitDrive implements a PowerShell NavigationCmdletProvider that mounts a Git repository as a PSDrive. Use cd, dir, Get-Content and other standard commands to browse branches, view commit history, and show diffs without touching the working tree. MOUNTING A DRIVE Navigate to any Git repository and run gcd: cd C:\MyRepo gcd Or mount explicitly with a custom drive name: New-GitDrive -Name PS -Path C:\MyProj\PowerShell DRIVE STRUCTURE Git:\ master Root branch (main or master) Git:\master\ feature/ Namespace folder (groups feature/* branches) hotfix/ Namespace folder bugfix-test Child branch (container) abc1234 Commit (leaf) Git:\master\feature\ login Branch feature/login signup Branch feature/signup Git:\master\feature\login\ abc1234 Commits unique to this branch def5678 (shared commits with parent are excluded) Branches are containers (cd into them). Commits are leaves. Branch names containing / become namespace folders. TABLE COLUMNS Name Branch name (blue) or commit SHA (yellow) Ahead Commits ahead of parent branch (+5) Date Commit date Author Commit author Message Commit message Refs Branches, tags, HEAD -> pointing to this commit The currently checked-out branch is marked with *. BROWSING BRANCHES dir List branches + commits dir -Recurse Show full branch hierarchy (no commits) cd feature\login Enter a child branch Get-Content .\abc1234 Show commit diff BRANCH OPERATIONS New-Item .\new-branch -Value master Create branch Remove-Item .\old-branch -Recurse Delete branch Rename-Item .\old -NewName new Rename branch ii .\feature\login Checkout (switch working tree) PIPELINE ANALYSIS The key advantage of GitDrive over git CLI is that branches and commits are PowerShell objects, enabling pipeline operations. Find merged branches: Get-ChildItem -Recurse | Where-Object { $_.IsBranch -and $_.Ahead -eq 0 -and -not $_.IsCurrent } Find stale branches (older than 3 months): Get-ChildItem -Recurse | Where-Object { $_.IsBranch -and $_.Date -lt (Get-Date).AddMonths(-3) } | Sort-Object Date Top 5 branches by commit count: Get-ChildItem -Recurse | Where-Object IsBranch | Sort-Object Ahead -Descending | Select-Object -First 5 Name, Ahead Branch health summary: $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 } Bulk delete merged branches: Get-ChildItem -Recurse | Where-Object { $_.IsBranch -and $_.Ahead -eq 0 -and -not $_.IsCurrent } | Remove-Item -Recurse OBJECT PROPERTIES Get-ChildItem returns GitCommitInfo objects with these properties: Name Branch name or short SHA Sha Full commit SHA Message Commit message Author Author name Date Author date (DateTime) Ahead Commits ahead of parent (branches only) Refs Branches/tags pointing to this commit IsBranch True for branches IsNamespace True for namespace folders IsCurrent True for the checked-out branch ShortSha 7-char SHA ShortMessage First line of message DateStr yyyy-MM-dd formatted date SEE ALSO Set-GitLocation (gcd) New-GitDrive |