Pacific-Design.com

    
Home Index

1. Git

2. Update All Repos

Git / Update All Repos /

Update All Repository within a parent directory

#!/bin/bash
#-----------------------------------------------------------------------------#
BASE="/home/durajkt/workspace/"

function update_git() 
{
    cd ${BASE}${1};
    git pull origin master
}
#-----------------------------------------------------------------------------#
DIRS=`find ${BASE} -maxdepth 1 -mindepth 1 -type d -exec basename {} \;`
for dir in ${DIRS}
do
    echo "Updating Repository: $dir"
    update_git $dir
    echo "Updated Repository: $dir"
    echo "-------------------------------------------------------"
done

#-----------------------------------------------------------------------------#