Skip to content

Instantly share code, notes, and snippets.

@instantiator
Last active July 14, 2023 15:27
Show Gist options
  • Select an option

  • Save instantiator/74800bf0db0407f0a3d84fe3e38f3d05 to your computer and use it in GitHub Desktop.

Select an option

Save instantiator/74800bf0db0407f0a3d84fe3e38f3d05 to your computer and use it in GitHub Desktop.
A tiny bash script to reset all your github repos to the main branch. Complements multi-git-status nicely.
#!/bin/bash
for d in */ ; do
echo "Checking: $d"
pushd $d
if git rev-parse --git-dir > /dev/null 2>&1; then
git checkout main
git pull
else
echo "... not a git repository."
fi
popd
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment