shell脚本批量调用git命令

有时候想对本地的几个repository都进行一下pull,一个一个操作比较繁琐,所以写了个shell脚本进行简化操作。

  1. git_pull_all.sh

     #!/bin/sh
     clear
    
     function showMsg()
     {
       echo -e "\033[32m$1\033[0m"
     }
    
     lstRepo=(
       Project01
       Project02
       Project03
       Project04
     )
     for repo in ${lstRepo[@]}
     do
       cd ../$repo
       showMsg '开始git pull '$repo
       git pull
     done
  2. start_pull.sh

     #!/bin/sh
     clear
    
     ./git_pull_all.sh
    
     echo
     echo
     echo
     echo
     echo -e "\033[32m=====================================\033[0m"
     echo -e "\033[32mPress any key to exit \033[0m"
     echo -e "\033[32m=====================================\033[0m"
     read
    原文作者:liqipeng
    原文地址: https://www.cnblogs.com/liqipeng/p/4895937.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞