Created
April 24, 2014 07:56
-
-
Save dtan4/11245664 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
USAGE="Usage: git_bulk.sh [pull|push|status]" | |
if [[ $# -lt 1 ]] ; then | |
echo $USAGE 1>&2 | |
exit 1 | |
fi | |
base_dir=$(pwd) | |
command=$1 | |
for dir in "dotfiles" "dot.emacs.d" "dot.zsh" "essential-packages" | |
do | |
echo "=== $dir" | |
cd $dir | |
case $command in | |
"pull") | |
git fetch | |
git merge FETCH_HEAD | |
if [[ -f "Rakefile" ]] ; then | |
rake | |
fi | |
;; | |
"push") | |
git push -u origin master | |
;; | |
"status") | |
git status -sb | |
;; | |
*) | |
echo $USAGE 1>&2 | |
exit 1 | |
;; | |
esac | |
cd $base_dir | |
echo "" | |
done | |
trap "cd $base_dir" EXIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment