Skip to content

Commit

Permalink
feat: sync-repo.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
chengcyber committed Apr 19, 2023
1 parent b48103f commit 16d87a2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions scripts/sync-repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

set -e

print_usage() {
echo "Usage: sync-repo.sh <folder1> <folder2> ..."
}

if [ $# -lt 1 ]; then
echo "Missing arguments"
print_usage
exit 1
fi


for folder in "$@"
do
echo "[log] Working on $folder..."
if [ -d "$folder" ]; then
(cd $folder && git fetch origin || echo "[Error] git fetch origin error")
else
echo "[Warn] Folder doesn't exist: $folder"
fi
done

0 comments on commit 16d87a2

Please sign in to comment.