Skip to content

Instantly share code, notes, and snippets.

@bvanskiver
Created June 22, 2022 20:32
Show Gist options
  • Save bvanskiver/d2a735dcd33a19bec074a8cfbc61b876 to your computer and use it in GitHub Desktop.
Save bvanskiver/d2a735dcd33a19bec074a8cfbc61b876 to your computer and use it in GitHub Desktop.
# Pull latest on all repos
for d in */; do
cd "$d" && echo "*********** $d ***********" &&
if [ -d .git ]; then
git pull
else
echo "Not a git repository, skipping.";
fi
cd .. && echo
done
# Show git status on all repos
for d in */; do
cd "$d" && echo "*********** $d ***********" &&
if [ -d .git ]; then
git status
else
echo "Not a git repository, skipping.";
fi
cd .. && echo
done
# Switch all repos to main branch
for d in */; do
cd "$d" && echo "*********** $d ***********" &&
if [ -d .git ]; then
git checkout main
else
echo "Not a git repository, skipping.";
fi
cd .. && echo
done
# Show local branches on all repos
for d in */; do
cd "$d" && echo "*********** $d ***********" &&
if [ -d .git ]; then
git branch
else
echo "Not a git repository, skipping.";
fi
cd .. && echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment