Skip to content

Instantly share code, notes, and snippets.

@dtan4
Last active August 29, 2015 14:00
Show Gist options
  • Save dtan4/11163508 to your computer and use it in GitHub Desktop.
Save dtan4/11163508 to your computer and use it in GitHub Desktop.
#!/bin/bash
USAGE="Usage: check.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"
do
echo "=== $dir"
cd $dir
case $command in
"pull")
git fetch
git --no-pager diff --stat FETCH_HEAD
git merge FETCH_HEAD
;;
"push")
git push -u origin master
;;
"status")
git status -s
;;
*)
echo $USAGE 1>&2
exit 1
;;
esac
cd $base_dir
done
trap "cd $base_dir" EXIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment