Skip to content

Instantly share code, notes, and snippets.

@AlexanderSerov
Last active January 12, 2024 20:40
Show Gist options
  • Save AlexanderSerov/1c43fa99c7efebb922bcd43040331b07 to your computer and use it in GitHub Desktop.
Save AlexanderSerov/1c43fa99c7efebb922bcd43040331b07 to your computer and use it in GitHub Desktop.
Print commit hashes of repo submodules recursively in powershell
param (
[string]$target = "HEAD"
)
function Print-Target {
foreach ($str in (git ls-tree -r $target)) {
if($str.Split(' ')[1] -eq "commit") {
Write-Output $str
}
}
}
Print-Target
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment