Skip to content

Instantly share code, notes, and snippets.

@bicpi
Created March 30, 2016 09:11
Show Gist options
  • Save bicpi/f275a4e215b717011197cbae9ddcd23a to your computer and use it in GitHub Desktop.
Save bicpi/f275a4e215b717011197cbae9ddcd23a to your computer and use it in GitHub Desktop.
This shell function is a hack to run git commands silently, e.g. for usage within build scripts
quiet_git() {
stdout=$(tempfile)
stderr=$(tempfile)
if ! git "$@" </dev/null >$stdout 2>$stderr; then
cat $stderr >&2
rm -f $stdout $stderr
exit 1
fi
rm -f $stdout $stderr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment