Compare PowerShell Git Log result

Viewed 38

I am working on the Azure DevOps pipeline and I am using PowerShell scripts, I want to check every commit exists pre-commit id if it does not have pre-commit id we need identify that commit :), To achieve that I managed to get the last 10 commit ids and pre-commit ids by using the following command, I want to know is there any better way to check this one from this list. Can i forloop this output. Much appreciate

git log -10 --no-merges master | Select-String -Pattern "commit"

commit 7d1cfe27356b5514777e28ced50f82ecba13e1a8
    Precommit-Verified: 7B8F9EBFD90E5C1628E63009707BB3CF038FADE0B4CCFD2FEFAD6828C557F343
commit 6bcf60212c8d2a229d9c4c37c1a041fe6686240b
    Precommit-Verified: 0F1A39C3C3929D9135ECB20380C6CCC5D06ED61EBD250FA3D40F2E7CBF1EBEF7
commit b130f46b4cbf9d09e9b4e747c6859f0c368596c7
    Precommit-Verified: 12C043126701CC02C39721339E6E1942DC942641B563A11839042D2248A8C8C4
commit 94e6202821a486dd93053df9c29697e49db8ba5f
    Precommit-Verified: 088387A89F135CC888A3E50A6415977522F60969F6D9D27A3B86AD26A8BB09DE
commit 9f094f8339b61923669e8bdbf6529db897b649fe
    Precommit-Verified: 47473E369CADB7F65D9BFE2C93F33D08C61F21A1057FD64913A99CF55984C782

Expected if commit contains Precommit-Verified its fine but commit does not have Precommit it must be flag

0 Answers
Related