-
-
Save miraculixx/5a684d3ede328125d7c3 to your computer and use it in GitHub Desktop.
dockrzone client command
This file contains 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
# 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