git fetch
控制台打印的命令输出信息有什么特别之处?我无法使用grep
,xargs
等。也无法将输出重定向到文件..
注意:我正在使用git fetch --dry-run
命令
[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]$
我正在尝试解析git fetch --dry-run
命令的输出以检查本地(master
)分支是否与远程(origin/master
)分支是最新的。