2

I tried this way:

pushOut=`git push`

But when I try:

echo $pushOut

I get an empty string

2
  • 1
    Look for option --porcelain in the manual. Commented Feb 21, 2017 at 12:42
  • Use alias instead command. such as alias ls='ls --color=auto' Then you can improve your git push Commented Feb 21, 2017 at 13:06

1 Answer 1

6

git push prints to stderr, apparently, so redirect stderr to stdout:

$ a=$(git push 2>&1)
$ echo "$a"
Everything up-to-date

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .