How To Silence Git In Powershell

The aim of this page📝 is to note how to silence git in PowerShell.

Context: I am moving my markdown files with a script to and from a backlog subfolder within a so-called slog folder — this is where I keep my work notes/to-do list. I do this quite often and don’t want a messy terminal with the lengthy git outputs but I need git to stage/commit deleted files and assets (screenshots) because I am using version control to tell me what I need to be working on (new/modified markdown files).

  • Calling move-to-backlog has only the output — nothing about git!
b -b
>>> VERBOSE: Performing the operation "Move File" on target "Item: C:\Users\Admin\ Destination: C:\Users\Admin\_backlog\".
  • git, like many CLIs (console/terminal programs), uses the stderr stream not just to report errors, but also for status information - basically, anything that's not data.
  • there are 7 streams in Powershell
name    | number | description
STDIN | 0 | Keyboard input
STDOUT | 1 | Text output
STDERR | 2 | Error text output
WARNING | 3 | Warning output
VERBOSE | 4 | Verbose output
DEBUG | 5 | Debug output
INFO | 6 | Information output (PowerShell 5.0+)
  • To suppress output from all 6 output streams, use *> $null
  • *> $null suppresses all output streams — while external programs only have 2 (stdout and stderr), applying *>$null to a PowerShell-native command silences all 6 output streams
  • * stands for all 6 streams
  • > is a redirect operator sending a specified stream to a file/variable
  • $null is null in PowerShell, you are not sending it anywhere
  • Of course, as a simpler example — you could silent git just by running *> $null after a git command.
~  master ↑6 +18 ~0 -0
▶ git push *>$null
~  master ≣ +18 ~0 -0

Technical Support Engineer/Technical Writer (Snowplow Analytics). with a passion for Python / writing documentation. More about me: