Skip to content

Instantly share code, notes, and snippets.

@simon-brooke
Created December 20, 2016 10:22
Show Gist options
  • Save simon-brooke/1956ecc2399269be51d8e7b5c2e18026 to your computer and use it in GitHub Desktop.
Save simon-brooke/1956ecc2399269be51d8e7b5c2e18026 to your computer and use it in GitHub Desktop.
Little script for cleaning up all my git repositories
#!/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