Created
February 27, 2023 12:02
-
-
Save jellesiderius/10091727fda9f6e91bc68a98213ee38c to your computer and use it in GitHub Desktop.
Bash script to reset + pull all latest git versions of underlying folders
This file contains 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 | |
# Loop through all directories in the current directory | |
for dir in */; do | |
# Enter the directory | |
cd "$dir" | |
# Check if the directory is a git repository | |
if [ -d ".git" ]; then | |
# Reset the repository to the latest version and pull the latest changes | |
git reset --hard HEAD | |
git pull | |
fi | |
# Return to the parent directory | |
cd .. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment