Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
493 views
in Technique[技术] by (71.8m points)

Can git operate in "silent mode"?

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can use --quiet or -q, which can also be used for other Git commands:

git commit --quiet
git push --quiet

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...