title: PowerShell Capture Git Output
body: <h3>Problem</h3>
  
  <p>I am running some git commands through PowerShell but I am having issues capturing the output.</p>
  
  <p>Many of the ways I have looked into have failed to capture any output at all until I tried using <code>Out-File</code> . Unfortunately, despite how well this has been working for me, I have found that something is going wrong with the <code>git push</code> command that is preventing me from capturing the output... </p>
  
  <p>My code looks as follows:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>When I look at the log files, it shows everything but the output of the <code>git push</code>. So in troubleshooting this, I removed the <code>| Out-File</code> from the line and noticed that even the output window was not showing the output of the <code>git push</code> anymore. It was only when I completely removed the <code>Out-File</code> from all of the git commands that I was able to get the output to display as expected again. Unfortunately, this put me back at square one.</p>
  
  <h3>Question</h3>
  
  <p>Does anyone know how to best capture the output of git commands using PowerShell, or can point out what I am doing wrong?</p>