Skip to content

Instantly share code, notes, and snippets.

@obar1
Last active September 15, 2024 10:52
Show Gist options
  • Save obar1/771b1992368262737d9f25fcf17ce1c1 to your computer and use it in GitHub Desktop.
Save obar1/771b1992368262737d9f25fcf17ce1c1 to your computer and use it in GitHub Desktop.
update 0 to 100 repos
#!/bin/bash
# set -x
function get_latest_0to100 {
cd 0to100.git
git switch main
git pull
cd -
}
function update_local_repo {
set -x
echo "$1" | tr '[:lower:]' '[:upper:]'
# pwd
git add -A
git stash
git pull
rm -rf "$1"/zero_to_one_hundred
cp -r ../0to100.git/zero_to_one_hundred .
git add . && git commit -m "wip" && git push
git stash apply
}
function update_f {
cp 0to100.git/"$1" "$2"
}
dirs_to_update=("0to100.datacamp.git" "0to100.gcloud.git" "0to100.oreilly.git" "kb.oreilly.git" "zero2hero.git" "0to100.dbt.git" "0to100.kaggle.git")
# dirs_to_update=("0to100.datacamp.git")
latest_files=(main.py requirements.txt)
get_latest_0to100
for d in "${dirs_to_update[@]}"; do
cd "$d"
update_local_repo "$d"
cd -
done
for d in "${dirs_to_update[@]}"; do
for f in "${latest_files[@]}"; do
echo "## $d"
update_f "$f" "$d"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment