Last active
September 24, 2020 20:38
-
-
Save nicholsonjf/e268114c5df633d538df4b8246034dc2 to your computer and use it in GitHub Desktop.
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/sh | |
## | |
# Loops through all the objects in the current directory. If the object is a git repo it | |
# performs a "git pull --rebase" and "git checkout master". | |
# | |
# To use as a shell command: | |
# | |
# OSX: | |
# Place this file in /usr/local/bin | |
# Make the file executable: "chmod u+x checkout-master" | |
# Run the command by using just the filename: $ checkout-master | |
# | |
# Pop!OS: | |
# Switch to OSX and see above. | |
## | |
for directory in */; do | |
if [ -d "$directory"/.git ]; then | |
echo $directory | |
git -C $directory pull --rebase | |
git -C $directory checkout master | |
else | |
echo "$directory is not a git repo." | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment