Last active
April 19, 2025 17:55
-
-
Save ManotLuijiu/5988bef6fcd6dd78b840e5f751a099cc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/bash | |
for app in "${apps_with_git[@]}"; do | |
echo "Checking branch in $app..." | |
git -C "$app" branch --show-current | |
done |
This file contains hidden or 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
#!/bin/bash | |
apps_with_git=() | |
for app in apps/*; do | |
if [ -d "$app/.git" ]; then | |
apps_with_git+=("$app") | |
echo "===== $app =====" | |
git -C "$app" status --short | |
echo | |
fi | |
done |
This file contains hidden or 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
#!/bin/bash | |
echo "π Auto-committing and pushing all changes..." | |
# List of apps you OWN and want to auto-commit/push for example | |
OWNED_APPS=("thai_google_sheets" "thai_business_suite" "translation_tools") | |
timestamp=$(date +"%Y-%m-%d %H:%M:%S") | |
for app in apps/*; do | |
app_name=$(basename "$app") | |
# Only proceed if it's in the list of owned apps | |
if [[ " ${OWNED_APPS[@]} " =~ " ${app_name} " ]]; then | |
if [ -d "$app/.git" ]; then | |
echo | |
echo "===== $app =====" | |
cd "$app" | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "π¦ Changes found. Committing and pushing $app_name..." | |
git add . | |
git commit -m "chore: Auto-commit on $timestamp" --no-verify | |
echo "π Pushing changes to remote..." | |
git push origin "$(git rev-parse --abbrev-ref HEAD)" | |
else | |
echo "β No changes $app_name is clean, nothing to commit" | |
fi | |
cd - >/dev/null | |
fi | |
else | |
echo "===== Skipping $app_name (not owned) =====" | |
fi | |
done | |
echo | |
echo "β All done!" | |
echo "π Auto-committing and pushing all changes..." |
This file contains hidden or 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
#!/bin/bash | |
echo "π Auto-committing and pushing all changes..." | |
# List of apps you OWN and want to auto-commit/push for example | |
OWNED_APPS=("thai_google_sheets" "thai_business_suite" "translation_tools") | |
timestamp=$(date +"%Y-%m-%d %H:%M:%S") | |
for app in apps/*; do | |
app_name=$(basename "$app") | |
# Only proceed if it's in the list of owned apps | |
if [[ " ${OWNED_APPS[@]} " =~ " ${app_name} " ]]; then | |
if [ -d "$app/.git" ]; then | |
echo | |
echo "===== $app =====" | |
cd "$app" | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "π¦ Changes found. Committing and pushing $app_name..." | |
git add . | |
git commit -m "chore: Auto-commit on $timestamp" | |
echo "π Pushing changes to remote..." | |
git push origin "$(git rev-parse --abbrev-ref HEAD)" | |
else | |
echo "β No changes $app_name is clean, nothing to commit" | |
fi | |
cd - >/dev/null | |
fi | |
else | |
echo "===== Skipping $app_name (not owned) =====" | |
fi | |
done | |
echo | |
echo "β All done!" | |
echo "π Auto-committing and pushing all changes..." |
This file contains hidden or 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
#!/bin/bash | |
echo "π Fixing remotes and pulling latest changes for all apps..." | |
cd ~/frappe-bench/apps | |
for app in */; do | |
if [ -d "$app/.git" ]; then | |
echo | |
echo "===== $app =====" | |
cd "$app" | |
echo "π Checking git remotes..." | |
git remote -v | |
# Add origin if missing | |
if ! git remote | grep -q "^origin$"; then | |
if git remote | grep -q "^upstream$"; then | |
upstream_url=$(git remote get-url upstream) | |
echo "π Adding 'origin' pointing to '$upstream_url'" | |
git remote add origin "$upstream_url" | |
else | |
echo "β οΈ No upstream found. Skipping $app" | |
cd .. | |
continue | |
fi | |
else | |
echo "β 'origin' already set." | |
fi | |
# Pull latest changes from the current branch | |
branch=$(git rev-parse --abbrev-ref HEAD) | |
echo "π₯ Pulling latest from origin/$branch..." | |
git pull origin "$branch" | |
echo "β Done with $app" | |
echo "-------------------------" | |
cd .. | |
fi | |
done | |
echo | |
echo "π All apps updated successfully!" | |
This file contains hidden or 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
#!/bin/bash | |
echo "π Checking all Git-enabled apps in ./apps..." | |
apps_with_git=() | |
for app in apps/*; do | |
if [ -d "$app/.git" ]; then | |
apps_with_git+=("$app") | |
echo | |
echo "===== $app =====" | |
# Show current branch | |
branch=$(git -C "$app" rev-parse --abbrev-ref HEAD) | |
echo "π¦ Branch: $branch" | |
# Show uncommitted changes | |
status=$(git -C "$app" status --short) | |
if [ -n "$status" ]; then | |
echo "π Uncommitted Changes:" | |
echo "$status" | |
else | |
echo "β Clean working tree" | |
fi | |
# Show if ahead/behind | |
git -C "$app" remote update >/dev/null 2>&1 | |
ahead_behind=$(git -C "$app" status -sb | grep '\[.*\]') | |
if [ -n "$ahead_behind" ]; then | |
echo "π Sync Status: $ahead_behind" | |
fi | |
# Show latest commit | |
last_commit=$(git -C "$app" log -1 --pretty=format:"%h %s (%cr)") | |
echo "π Last Commit: $last_commit" | |
fi | |
done | |
echo | |
echo "β Done. Checked ${#apps_with_git[@]} Git-enabled apps." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you're using pre-commit hooks (like Husky with lint-staged), use the --no-verify flag in the auto-commit-no-verify-push.sh script.