Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stopthatastronaut/0dfa0dcde4ed8e306bf7126e22b3abb3 to your computer and use it in GitHub Desktop.
Save stopthatastronaut/0dfa0dcde4ed8e306bf7126e22b3abb3 to your computer and use it in GitHub Desktop.
powershell/git: Have files changed in subfolders?
Get-ChildItem -Directory | ForEach-Item {
$folder = $_.Name
$LATEST_COMMIT = $(git rev-list -n 1 --no-merges HEAD)
$FOLDER1_COMMIT = $(git log -1 --format=format:%H --full-diff ./${folder}/)
Write-Output $folder
Write-Output "latest commit $LATEST_COMMIT"
Write-Output "folder commit $FOLDER1_COMMIT"
}
@stopthatastronaut
Copy link
Author

If the hashes match, files have changed. Kinda useful in some CI scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment