Last active
October 21, 2019 20:18
-
-
Save burtonr/e56349380ebce03a8fe7762d8646641c to your computer and use it in GitHub Desktop.
Work in Progress Directory Scan
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.DESCRIPTION | |
Script to recursively run `git status` on all sub-directories in order to find out | |
if, or where, you have uncommited files. AKA: Work-in-progress. | |
The only pre-requisite is that git is installed. | |
This will work on any operating system with Powershell installed | |
#> | |
$ErrorActionPreference = 'SilentlyContinue' # Silence the "not a git repository" errors | |
$repoDir = "C:\Users\<your username>\source\repos" | |
$repos = Get-ChildItem $repoDir | |
ForEach($r in $repos) { | |
Write-Host "Checking $r" -ForegroundColor Green | |
Set-Location $repoDir\$r | |
$status = git status | |
if(!$status.Contains('nothing to commit, working tree clean')) { | |
if($status -like "*modified*") { | |
Write-Host "Unstaged changes found:" -ForegroundColor Red | |
git status -uno | |
} | |
else { | |
Write-Host "Untracked files found." -ForegroundColor Yellow | |
} | |
} | |
Set-Location $PSScriptRoot | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment