What is special about the output message of git fetch
command that is printed on the console? I'm not able to use grep
, xargs
, etc. Not able to redirect the output to a file also..
Note: I'm using git fetch --dry-run
command
[sangeeth@localhost santest-code]$
[sangeeth@localhost santest-code]$ git fetch --dry-run > /tmp/1
From ssh://git.code.sf.net/p/santest/code
9f068d0..2b9dc4e master -> origin/master
[sangeeth@localhost santest-code]$
[sangeeth@localhost santest-code]$ cat /tmp/1 <= no data
[sangeeth@localhost santest-code]$
[sangeeth@localhost santest-code]$ git fetch --dry-run | grep "ssh" <= output has both lines
From ssh://git.code.sf.net/p/santest/code
9f068d0..2b9dc4e master -> origin/master
[sangeeth@localhost santest-code]$
[sangeeth@localhost santest-code]$ git --version
git version 1.7.11.4
[sangeeth@localhost santest-code]$
I'm trying to parse the output of git fetch --dry-run
command to check whether the local (master
) branch is up-to-date with the remote (origin/master
) branch.
Some of git's status output goes to STDERR
. If you want to grep through it, merge STDERR into STDOUT like so:
git fetch --dry-run 2>&1 | grep ssh
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With