Skip to content

Instantly share code, notes, and snippets.

@dtan4
Created April 24, 2014 07:56
Show Gist options
  • Save dtan4/11245664 to your computer and use it in GitHub Desktop.
Save dtan4/11245664 to your computer and use it in GitHub Desktop.
#!/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