Search code examples
gitgit-revert

git revert in silent/quiet/non-verbose mode?


A number of git commands have a -q or --quiet parameter, which prevents most of the cli output. See https://stackoverflow.com/a/8943761/246724

I have not found such a parameter for git revert.

Is there a trick I could use to prevent git revert from showing a complete list of files that were affected?

I want to use it inside a cli script, and for this the output is just too much.


Solution

  • According to git documentation, there is no way to suppress the output of git revert command directly.

    What you can do instead, is to redirect all the output instead, i.e. via git revert >/dev/null (for Linux) or git revert >NUL (for Windows).

    This will redirect the standard output. If you also don't want to see errors (i.e. if you want to get rid of the standard error output as well), you can add 2>&1 to the end of command line.