Skip to content

Instantly share code, notes, and snippets.

@rdm
Last active December 15, 2015 13:19
Show Gist options
  • Save rdm/5266251 to your computer and use it in GitHub Desktop.
Save rdm/5266251 to your computer and use it in GitHub Desktop.
a clunky example of a git sync script This is not in any way general, nor even efficient - it's the sort of thing that I evolve by addressing specific problems when they arise. In particular: The pip install stuff is relevant because this project uses django with an evolving list of requirements. the /tmp/requirements.txt is to avoid spending a …
#!/bin/sh
set -e
trap 'echo FAILED (need git push -u on new branch?)' EXIT
[ -r "$VIRTUAL_ENV" ]
branch=`git branch|awk '/\*/{print $2}'`
find . -iname '*.pyc' -print0 | xargs -0 rm -f
git fetch --prune origin
git pull origin $branch
git pull origin develop
while ! [ -e setup/requirements.txt ]; do cd -P .; cd ..; done
diff setup/requirements.txt /tmp/requirements.txt || time pip install --upgrade -i http://23.20.194.155/simple -r setup/requirements.txt
cp -f setup/requirements.txt /tmp/requirements.txt
trap ":" EXIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment