Skip to content

Instantly share code, notes, and snippets.

@miraculixx
Created December 19, 2014 18:38
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 miraculixx/5a684d3ede328125d7c3 to your computer and use it in GitHub Desktop.
Save miraculixx/5a684d3ede328125d7c3 to your computer and use it in GitHub Desktop.
dockrzone client command
# dokku remote command
function dz() {
case $1 in
push)
# top level git directory
LOCAL_BRANCH="$(git branch -l 2>/dev/null | grep '\*' | awk '{print $2}')"
if [ -d .git ]; then
echo "Pushing branch $LOCAL_BRANCH to dz master"
git push dz $LOCAL_BRANCH:master
else
# not top-level, use subtree split
GIT_TOPLEVEL="$(git rev-parse --show-toplevel)"
PREFIX=${PWD#"$GIT_TOPLEVEL/"}
pushd $GIT_TOPLEVEL
echo "Pushing subtree $PREFIX"
git subtree push --prefix=$PREFIX dz master
popd
fi
;;
*)
ssh -t dokku@dockrzone.com $*
;;
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment