ansible/gitpull.sh: add script for updating repos

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2022-10-30 00:51:35 +02:00
parent 2c47795bb8
commit 0a14bff80c
No known key found for this signature in database
GPG Key ID: 09AA5403E54D9931
1 changed files with 18 additions and 0 deletions

18
ansible/gitpull.sh Executable file
View File

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -e
for DIR in ~/work/infra-*; do
pushd $DIR >/dev/null
NAME=$(basename $DIR)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
if [[ "${BRANCH}" != "master" ]]; then
printf "%-30s - %s\n" "$NAME" "FEATURE"
elif git diff --quiet; then
git pull origin master >/dev/null 2>&1
printf "%-30s - %s\n" "$NAME" "UPDATED"
else
printf "%-30s - %s\n" "$NAME" "DIRTY"
git status
fi
popd >/dev/null
done