I am using the below code to git commit the change and return the commitid
function gitcommit()
{
git commit -a -m "message"
$commitid= git rev-parse HEAD
git push -q
$comid=$commitid
return $comid
}
function main()
{
$commitid= gitcommit()
Write-Host "Commit id is $commitid"
}
In the gitcommit
function I am to get the correct commit id as 7de234567f68fa8a3b40a95abc4d6d82a75d93
.
But the problem I am facing is that, while returning the commit id as a string it is coming as a type System. Array with the below content
On branch master, Your branch is up to date with 'origin/master'., , nothing to commit, working tree clean, On branch master, Your branch is up to date with 'origin/master'., , nothing to commit, working tree clean,7de234567f68fa8a3b40a95abc4d6d82a75d93