Is it possible to execute any git command in “silent” mode? For instance, can i say “git push origin” and see nothing displayed on the screen?
I suppose i can redirect IO to /dev/null (works fine), but .. does git allow something like this naturally?
Below is a quick script that does automatic EOD commit, used when i need to catch the train and don’t want to leave code on my local computer
1 clear
2
3 cd
4 cd repo/active
5
6 for i in *
7 do
8 cd $i
9 echo "Pushing " $i
10 git add . -A >> /dev/null
11 git commit -a -m "EOD automatic commit" >> /dev/null
12 git push origin >> /dev/null
13 echo
14 cd ..
15 done
Please let me know.
Redirecting output to /dev/null seems like a natural way of doing it to me. Although I have in the past defined a quiet_git shell function like this for use in cron jobs:
This will suppress stdout and stderr, unless the git command fails. It’s not pretty; in fact the stdout file is ignored and it should just redirect that to /dev/null. Works, though. And then you can just do “quiet_git push” etc. later on in the script.