This script isn't mine. Favna made it, so all rights go to him.
Created
October 25, 2019 08:37
-
-
Save cfanoulis/3867ff1a125f38b899d4c8ef0dd4324d to your computer and use it in GitHub Desktop.
pika-fetch
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
#!/bin/bash | |
ASCIIPIKACHU="H4sICNWssl0CA3Bpa2EudHh0AH2SPU/EMAyG9/wK3y2+Somze0MsIBYWtkgWQgcMh27pWPHbsfPV9q4lQxonT22/toGZvQPUDyOJAwAk6PvWEiHvyQH8wwpRQF3q9ejqXSq7pxCOukIgr0zlGQ2LqXC3/rKtHpWJxVHaSAzNSayheDN3drEmwzvq2DXX+0SLXgkfgu+v3s6KFKYS00kGnqAZdjYkM1yLiiFgPmQpAaW4mcXErjpVEVEv9MnBjJ3sOKzyTRLt5es6wniFz/P48Q14/oH3y+Vg/1qntMJspMQcXG9KNiW/6GpXKPDmXFBRg2DCzAEVGSZHR0EjNC3MU68r5rXonw0VeZtE3i9/psxRbuEeZZy0kHMn4hrRPBc+21TwPZknkA3nPIUd43sUal64BMl0DjfFY2g9LgZXbomtGLWQCFfTJ2oLzYgJ77iWXhuZcpllcCvxyPaGMrRiYJe2qBDaHLw+vzz85v3x6e3g3B9DCorQNgQAAA==" | |
function fetchAllRepos() { | |
for i in $(find . -name .git -type d); do | |
dir=$(dirname $i) | |
pushd "${dir}" | |
echo "Processing git status in ${dir}" | |
git fetch origin -v -q | |
STATUS=$(git status | grep -v 'nothing to commit' | grep -v 'up-to-date' | grep -v '^On branch master$') | |
if [[ ! -z "${STATUS}" ]]; then | |
echo "${STATUS}" | grep --color -E '^|behind|ahead|On branch .*' | |
fi | |
FF=$(echo "${STATUS}" | grep -c 'can be fast-forwarded') | |
if [[ "${FF}" != "0" ]]; then | |
git pull | |
fi | |
echo "-------------" | |
popd | |
done | |
} | |
base64 --decode <<<${ASCIIPIKACHU} | gunzip | |
fetchAllRepos |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment