需求
- 如果当前目录下全部是git 仓库,手动进入每个目录,并执行
git pull
,操作重复,费时费力 - 结合网上搜索的例程,整理了一下,实现自动拉取当前目录下所有的 git 仓库
shell 脚本
-
windows上的git bash,其实是一个
mingw64
的环境,可以运行Linux的大部分命令,支持Linux shell脚本的运行#! /bin/bash
function git_pull_all() {
for dir_name inls $1
do
cur_dir=“ 1 / 1/ 1/dir_name”
# echo $cur_dir
if [ -d $cur_dir ]
then
echo