sh 简单的bash脚本,用于获取并将执行文件夹中的所有repos拉到它们所在的最新分支

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 简单的bash脚本,用于获取并将执行文件夹中的所有repos拉到它们所在的最新分支相关的知识,希望对你有一定的参考价值。

#!/bin/bash

################
# Uncomment if you want the script to always use the scripts
# directory as the folder to look through
#REPOSITORIES="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
REPOSITORIES=`pwd`

IFS=$'\n'

for REPO in `ls "$REPOSITORIES/"`
do
  if [ -d "$REPOSITORIES/$REPO" ]
  then
    echo "Updating $REPOSITORIES/$REPO at `date`"
    if [ -d "$REPOSITORIES/$REPO/.git" ]
    then
      cd "$REPOSITORIES/$REPO"
      git status
      echo "Fetching"
      git fetch
      echo "Pulling"
      git pull
    else
      echo "Skipping because it doesn't look like it has a .git folder."
    fi
    echo "Done at `date`"
    echo
  fi
done

以上是关于sh 简单的bash脚本,用于获取并将执行文件夹中的所有repos拉到它们所在的最新分支的主要内容,如果未能解决你的问题,请参考以下文章

sh 用于打开magento 2模板和阻止提示的Shell脚本,将文件添加到流浪者中的〜/ bin并将权限设置为755

linux shell 问题,清除文件中的空格

sh 用于保存所有docker镜像的脚本,并将其加载回来

sh 用于测试写入json格式文件的简单脚本

sh 获取当前文件夹执行bash脚本

sh 在执行时获取shell / bash脚本文件的绝对路径