aboutsummaryrefslogtreecommitdiff
path: root/scripts/powershell/Get-GitDirty.ps1
blob: 9216ef2da5cf0c23d9059cc3f9252f6ea2c93d16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<#
.SYNOPSIS
    Lists immediate subdirectories containing git repositories with pending changes.

.DESCRIPTION
    This script scans all depth-1 directories in the current location. 
    It filters for valid git repositories and checks if 'git status' returns any output.
    Only the names of repositories with uncommitted changes (dirty) are returned.

.EXAMPLE
    PS C:\MyProjects> Get-GitDirty

    Returns a list of folder names that have pending changes.
#>

Get-ChildItem -Directory | 
Where-Object { Test-Path "$($_.FullName)\.git" } | 
Where-Object { git -C $_.FullName status --porcelain } | 
Select-Object Name