4
打印在控制檯上的git fetch
命令的輸出消息的特別之處是什麼?我不能夠使用grep
,xargs
等不能輸出重定向到一個文件也..Git:無法重定向/解析'git fetch --dry-run'命令的輸出
注:我使用git fetch --dry-run
命令
[[email protected] santest-code]$
[[email protected] santest-code]$ git fetch --dry-run > /tmp/1
From ssh://git.code.sf.net/p/santest/code
9f068d0..2b9dc4e master -> origin/master
[[email protected] santest-code]$
[[email protected] santest-code]$ cat /tmp/1 <= no data
[[email protected] santest-code]$
[[email protected] 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
[[email protected] santest-code]$
[[email protected] santest-code]$ git --version
git version 1.7.11.4
[[email protected] santest-code]$
我試圖解析命令git fetch --dry-run
的輸出檢查本地(master
)分支是否與遠程分支(origin/master
)保持同步。