Created
December 20, 2016 10:22
-
-
Save simon-brooke/1956ecc2399269be51d8e7b5c2e18026 to your computer and use it in GitHub Desktop.
Little script for cleaning up all my git repositories
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 | |
# Little script for cleaning up all my git repositories (i.e. ones I am responsible | |
# for) in my workspace dir and pushing them back to gihub or to my own server. | |
pushd ~/workspace | |
for dir in * | |
do | |
if [ -d ${dir} ] | |
then | |
pushd ${dir} | |
if [ -d .git ] | |
then | |
git remote get-url origin | grep '[email protected]:simon-brooke' > /dev/null | |
if [ $? -eq 0 ] | |
then | |
git gc --aggressive; | |
git push | |
fi | |
git remote get-url origin | grep '[email protected]' > /dev/null | |
if [ $? -eq 0 ] | |
then | |
git gc --aggressive; | |
git push | |
fi | |
fi | |
popd | |
fi | |
done | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment