Problem
I run several git commands through PowerShell, but I'm having problems grabbing output.
Many of the ways I was looking for were unable to capture any output at all until I tried using Out-File . Unfortunately, despite how well this works for me, I found that something was wrong with the git push command, which was stopping me from grabbing the output ...
My code is as follows:
git add . | Out-File $logFilePath -Append git status . | Out-File $logFilePath -Append git commit -m "Some Relevant update message" | Out-File $logFilePath -Append git push origin $branchname | Out-File $logFilePath -Append
When I look at the log files, it shows everything except the output of git push . Therefore, when troubleshooting, I deleted | Out-File | Out-File from the line and noticed that even the output window no longer displays git push output. Only when I completely removed Out-File from all git commands so that I can display the output again as expected. Unfortunately, this brought me back to the square.
Question
Does anyone know what is the best way to capture the output of git commands using PowerShell or indicate what I am doing wrong?
source share