aboutsummaryrefslogtreecommitdiff
path: root/scripts/powershell/Get-GitDirty.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/powershell/Get-GitDirty.ps1')
-rw-r--r--scripts/powershell/Get-GitDirty.ps119
1 files changed, 19 insertions, 0 deletions
diff --git a/scripts/powershell/Get-GitDirty.ps1 b/scripts/powershell/Get-GitDirty.ps1
new file mode 100644
index 0000000..9216ef2
--- /dev/null
+++ b/scripts/powershell/Get-GitDirty.ps1
@@ -0,0 +1,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 \ No newline at end of file