我想使用此bash脚本将分支分支到位于子目录中的几个git项目中。
gzz (){
for d in admin_pci merchant_pci gateway_pci gw_plugin gateway_web_console web_payment
do
( cd $d && git pull && git checkout $(git branch -r | grep "$1" | awk '{print substr(""$1"",8,length)}'); )
done
}
使用gzz feature/b2017110901_develop_submdoule_update
时,我得到:
gzz feature/b2017110901_develop_submdoule_update
Already up-to-date.
D config/database.yml.example
Already on 'feature/b2017110901_develop_submdoule_update'
Your branch is up-to-date with 'origin/feature/b2017110901_develop_submdoule_update'.
Saving session...
...saving history...truncating history files...
...completed.
Already up-to-date.
D config/database.yml.example
Already on 'feature/b2017110901_develop_submdoule_update'
Your branch is up-to-date with 'origin/feature/b2017110901_develop_submdoule_update'.
Saving session...
...saving history...truncating history files...
...completed.
但是当我使用gzz开发时,我得到了
error: pathspec 'develop' did not match any file(s) known to git.
如果我手动执行脚本,它将正常运行。
您能给我一些可能出问题的建议吗?