Posted almost 6 years ago. Visible to the public.

Small script for updating all git repositories within a directory.

A simple shell script that jumps into a given directory (or a default one) and updates all git repos in there. Additionally it checks if an upstream remote exists. If that is the case it fetches the upstream changes.

#!/usr/bin/env zsh if [[ -z "$1" ]] then DIR=~/Code else DIR="$1" fi CURRENT_DIR=`pwd` for repo in "${DIR}/"*; do if [[ -d "${repo}/.git" ]] then cd "${repo}" echo -e "\033[1mFound git repository in $repo.\033[0m" git fetch if [[ ! -z `git remote | grep upstream` ]] then echo -e "\033[1mFetching upstream changes for $repo.\033[0m" git fetch upstream fi fi done cd "${CURRENT_DIR}"

Owner of this card:

Last edit:
almost 4 years ago
by jan0sch
Posted by jan0sch to jan0sch's deck
This website uses cookies to improve usability and analyze traffic.
Accept or learn more