Created
June 28, 2020 09:38
-
-
Save MrLotU/da5dc3c7863a64cbe665f7304f4640c8 to your computer and use it in GitHub Desktop.
Pull all GIT subdirectories from current directory.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subpull() { | |
BASEPWD="${PWD}" | |
for d in `find . -type d -depth 1`; do | |
cd "${BASEPWD}" | |
cd "${d}" | |
GIT_STATUS="$(git status 2>&1)" | |
if [[ $GIT_STATUS == *"not a git repository"* ]] | |
then | |
echo "${d} is not under git control. Skipping" | |
continue | |
fi | |
echo "${d}:" | |
if [[ "$*" == *--master* ]] | |
then | |
git checkout master | |
fi | |
git pull | |
done | |
cd "${BASEPWD}" | |
if [[ "$*" == *--open* ]] | |
then | |
xed . | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment