Skip to content

Instantly share code, notes, and snippets.

@grok
Created April 28, 2014 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grok/11375013 to your computer and use it in GitHub Desktop.
Save grok/11375013 to your computer and use it in GitHub Desktop.
This was an old script I wrote, I later converted to ruby: https://github.com/grok/script-update-repositories
#!/bin/bash
# This is where I want my script to start.
cd ~/Projects/
# Let the person running the script know what's going on.
echo -e "\n\033[1mPulling in latest changes for all repositories...\033[0m\n"
# Find all directories here - that are at least 1 level down, but don't go any further than 1 directory.
# Go into those directories and pull the repository.
for i in $(find . -maxdepth 1 -mindepth 1 -type d); do
echo -e "\033[1m"+$i+"\033[0m"; cd $i; git remote -v; git pull;
cd ~/Projects/DealerTrend
done
echo -e "\n\033[1mComplete! Do work son!\033[0m\n"
Once you've made your shell script executable and run it - you should see output similar to this:
[myuser@mycomputer:~/Projects/] $ ./updateRepositories.sh
Pulling in latest changes for all repositories...
+./sandbox+
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git
+./myawesomerepo+
origin remoteuser@gitserver:myrepo.git (fetch)
origin remoteuser@gitserver:myrepo.git (push)
Already up-to-date.
+./myapplication+
origin remoteuser@gitserver:myrepo.git (fetch)
origin remoteuser@gitserver:myrepo.git (push)
Already up-to-date.
+./wordpress-plugin-open-source+
origin remoteuser@gitserver:myrepo.git (fetch)
origin remoteuser@gitserver:myrepo.git (push)
public remoteuser@gitserver:myrepo.git (fetch)
public remoteuser@gitserver:myrepo.git (push)
Already up-to-date.
Complete! Do work son!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment