Last active
November 21, 2022 17:10
-
-
Save saltedcoffii/752a548737d23d98b44c2dab754e4301 to your computer and use it in GitHub Desktop.
update-git-repos.sh: update all git repositories in the current directory
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 | |
# update-git-repos.sh: update all git repositories in the current directory | |
# Copyright (C) 2022 Cassandra Watergate | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
# GNU General Public License for more details. | |
for i in */; do | |
pushd ${i}; | |
git fetch origin; | |
git pull origin $(git branch --show-current); | |
git reflog expire --expire=0; | |
git prune; | |
git prune-packed; | |
git gc --prune=all; | |
popd; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm a software packager, and it's nice to be able to look at the way linux distros package files. I have a huge directory of package build scripts from archlinux, gentoo, void, alpine, and adélie linux and updating them all one at a time, or dealing with the huge amount of space that a fully deep .git directory takes up is really annoying. This script solved all my problems and I'm putting it here in hopes that someone else will find it useful too. Let me know if you use it in the comments below!!